Skip to content

Instantly share code, notes, and snippets.

@arieljannai
Last active May 13, 2022 11:20
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save arieljannai/24f71e84457d41d4ea5b34054d337346 to your computer and use it in GitHub Desktop.
Save arieljannai/24f71e84457d41d4ea5b34054d337346 to your computer and use it in GitHub Desktop.
Get YouTube Channel RSS Feed
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];
console.log('The rss feed of the channel \'' + channelTitle + '\' is:\n' + channelRss);
break;
}
}
@fonko
Copy link

fonko commented Nov 2, 2018

undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment