top | item 43405288

(no title)

presto8 | 11 months ago

This bookmarklet will show the RSS feed URL in an alert window:

Original Source: https://webapps.stackexchange.com/a/116549

    javascript: (() => {

    for (var arrScripts = document.getElementsByTagName('script'), i = 0; i < arrScripts.length; i++) {
        if (arrScripts[i].textContent.indexOf('externalId') != -1) {
            var channelId = arrScripts[i].textContent.match(/\"externalId\"\s*\:\s*\"(.*?)\"/)[1];
            var channelRss = 'https://www.youtube.com/feeds/videos.xml?channel_id=' + channelId;
            var channelTitle = document.title.match(/\(?\d*\)?\s?(.*?)\s\-\sYouTube/)[1];
            alert('The rss feed of the channel \'' + channelTitle + '\' is:\n' + channelRss);
            break;
        }
    }

    })();

discuss

order

extra88|11 months ago

The script doesn't work anymore, `externalId` is no longer found in the page source.

That's okay, I've found a regular type="application/rss+xml" <link> is in the page head of YouTube channel pages but only if you load that page directly; if you follow links within the site to the channel page, it's an SPA and you don't get the channel URL's <link> elements.

The channel page also has a <link rel="canonical" …> and that URL ends with the channel ID, even if it has an `@` handle.