Last active
July 5, 2024 08:26
-
-
Save arieljannai/24f71e84457d41d4ea5b34054d337346 to your computer and use it in GitHub Desktop.
Get YouTube Channel RSS Feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
undefined