James Cridland

YouTube has RSS feeds... kind of

So… this is potentially interesting. YouTube has RSS feeds. Kind of.

An RSS feed for a channel

https://www.youtube.com/feeds/videos.xml?channel_id=UC-FB5CRs-XUNMdDDphQUDEA

The above is an RSS feed for the Podnews channel. You find the channel ID in this URL by going to the “about” page and hitting the share icon (a kind of arrow on the right-hand side) and choose “copy channel ID” after clicking it.

An RSS feed for a playlist/podcast

https://www.youtube.com/feeds/videos.xml?playlist_id=PLusOJN4fPK_u0dMxl_xRCTNT1GKaM6vtU

The above is an RSS feed for the Podnews Daily podcast, which is a playlist on YouTube. The playlist ID is visible in the URL when visiting a specific playlist.

But…

While these are RSS feeds, they’re not podcast feeds: and have no enclosure. So, no downloading the video (or audio) into a podcast app, even if YouTube claims it is a podcast platform. It isn’t.

But could you parse the RSS feeds to make a podcast-compatible RSS feed?

The thumbnails are easy enough - they’re in the <media:thumbnail> field. For this video with a video ID of imIk_pKKR5o the thumbnail is this: https://i2.ytimg.com/vi/imIk_pKKR5o/hqdefault.jpg

Understandably, the video link is going to be harder to get. One of the online “download videos from YouTube” websites gives me the following URL…

https://rr1---sn-fpqxc5oq-hxas.googlevideo.com/videoplayback?expire=1687449092&ei=pBmUZLT_KMvvyQXVnISAAQ&ip=195.246.120.54&id=o-ACW-Xt-z5OG2IuCGSih4SAMIHmXieg-ayvC4YosFSZru&itag=22&source=youtube&requiressl=yes&spc=qEK7B7ve3QgIepbtWUQdslbFx9X5Z_dp85pSM7sDBg&vprv=1&svpuc=1&mime=video%2Fmp4&ns=yYUBLrmJlCBSwkH2zM9us9AN&cnr=14&ratebypass=yes&dur=245.783&lmt=1687323730509975&fexp=24007246&c=WEB&txp=6218224&n=uLaNDA-2cJQ3uQ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRAIgIvXVDpKd9whj7VbObF3SjmkKMLj_N2XA3NiPE49W2ZQCIAL2_A8Iy9gZ3NZXZzudRzItEHa0MOqXeS75-lPMCvgN&title=Podcast%20Day%20Asia%20launched&redirect_counter=1&rm=sn-5gold7z&req_id=d5dfe827d580a3ee&cms_redirect=yes&ipbypass=yes&mh=Pb&mip=[snip]&mm=31&mn=sn-fpqxc5oq-hxas&ms=au&mt=1687427108&mv=m&mvi=1&pcm2cms=yes&pl=45&lsparams=ipbypass,mh,mip,mm,mn,ms,mv,mvi,pcm2cms,pl&lsig=AG3C_xAwRgIhAM4rqJ6kXaC72CF5hLQdHVjngtTml960qd8Sb_hnsq-aAiEAy41BDQ322coS9dB9ewy5YtDhtIw2a0k8Ba3W1Q584QE%3D

…yikes. The above URL also had my (IPv6) IP address in it, where I’ve [snip]’d the URL above. The “expire” value is unixtime for “six hours from now”, as a matter of interest, so it looks unlikely that you could make a long-lasting URL for a video.

You could download and re-host a video with YouTube-DL, though that would be a copyright violation.

But…

But could you add the capability of playing a YouTube RSS feed into a podcast app that you’re developing?

Looks like it. You’d just need to embed a YouTube video playback window. (Those are controllable via a JavaScript API, so potentially you could retain standard podcast playback controls over the top).

It returns https://www.youtube.com/v/imIk_pKKR5o?version=3 as the media:content; you can manipulate that to be https://www.youtube-nocookie.com/embed/imIk_pKKR5o?autoplay=1 which plays back just fine in a webview window. Here are the docs for those embed parameters.

However, YouTube’s search quota is really very low - you normally get a total of 100 searches a day if you’re using the API.