Get latest video from a YouTube RSS feed

Because it was really hard to find something about this with Google or the forums search engine, I’m posting this for future reference and to perhaps help others looking for the same solution.

I was looking for a way to post the latest video of any given YouTube channel, the title and a link to it. I couldn’t find a way to get it working with the pure RSS of YouTube, but using a RSS to JSON converting API (I used rss2json.com, but there are several such services), I was able to get the data as JSON and extract it easily from there.

Latest YouTube video: $(eval const rss = $(urlfetch json https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fwww.youtube.com%2Ffeeds%2Fvideos.xml%3Fchannel_id%3D<CHANNEL_ID_HERE>); rss.items[0].title + " - youtu.be/" + rss.items[0].guid.split(":")[2];)

You will need to change the CHANNEL_ID_HERE part with your actual channel ID (not your channel name). This will result in something like:

Latest YouTube video: My top 10 ice cream flavors - youtu.be/some-link

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.