Last active
March 1, 2022 23:07
-
-
Save arkov/e8c0d463c9817d4b0b90462992589198 to your computer and use it in GitHub Desktop.
Youtube subscriptions to RSS & OPML
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
// I modified the code I found on Duc's site here: | |
// https://hoanganhduc.github.io/blog/2021/04/16/youtube-subscriptions-to-rss-feeds/ | |
// This might and will break at the slightest touchup made by the devs @ Youtube | |
// instructions: | |
// 1. navigate to https://www.youtube.com/feed/channels | |
// 2. scroll all the way down | |
// 3. paste all the code into the console | |
// 4. copy the ouput and paste it at the following website | |
// in order to generate OPML https://opml-gen.ovh/ | |
x = $$("#main-link.channel-link").map( el => { | |
ytb = "https://www.youtube.com/feeds/videos.xml?"; | |
usr = "/user/"; | |
chn = "/channel/"; | |
i = el.pathname.indexOf(usr); | |
j = el.pathname.indexOf(chn); | |
// unexpected input | |
if (i < 0 && j < 0) return "broken: " + el.pathname; | |
// user | |
if (j < 0) return ytb + "user=" + el.pathname.substring(usr.length); | |
// channel | |
return ytb + "channel_id=" + el.pathname.substring(chn.length); | |
}); | |
console.log(x.join("\n")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment