W3docs

How to get a Youtube channel RSS feed after 2015 April 20 (without v3 API)?

After April 20, 2015, YouTube discontinued support for the RSS feed feature in the version 2 of their API.

After April 20, 2015, YouTube deprecated the RSS feed endpoints in API v2, but channel RSS feeds remain accessible via a direct URL without using the v3 API. You can retrieve a channel's feed by appending the channel ID to the standard endpoint: https://www.youtube.com/feeds/videos.xml?channel_id=CHANNEL_ID

In PHP, you can fetch and parse this feed using built-in XML functions. The following example retrieves the latest video titles and links without requiring an API key or third-party services:

<?php
$channelId = 'UC_x5XG1OV2P6uZZ5FSM9Ttw'; // Replace with your YouTube channel ID
$rssUrl = "https://www.youtube.com/feeds/videos.xml?channel_id={$channelId}";

$xml = simplexml_load_file($rssUrl);
if ($xml === false) {
    die('Failed to load RSS feed. Check the channel ID and network connection.');
}

foreach ($xml->entry as $entry) {
    $title = (string) $entry->title;
    $link = (string) $entry->link['href'];
    echo "Title: {$title}\nLink: {$link}\n";
}
?>

This approach bypasses the v3 API entirely, requires no authentication, and works directly with YouTube's public feed endpoint.