Using iOS Shortcuts and JavaScript To Extract RSS Feed URLs From YouTube

Published: | Updated:

A few months ago, I got into RSS readers. Given how much YouTube I watch along with YouTube’s broken subscription tab, I wondered if YouTube had RSS feeds.

Turns out it does, but they aren’t advertised. Even with an RSS reader that discovers feeds, it only works for certain pages. So I decided to use iOS Shortcuts to do it for me.


The shortcut will works like this:

  1. Parse the URL for the Channel or Playlist ID and return the feed URL
  2. If step 1 works, ask the user if they want to copy the URL. If so, copy it.
  3. If step 2 doesn’t work, notify the user.

In this post, I’ll focus on 1.

The JavaScript

I expected to do a lot of DOM manipulation and web scraping, but the URL has everything I need. All the feed URLs build on the URL

Type URL Pattern Feed URL id
User (user) tonjesml
Playlist (playlist_id or PLv3TTBr1W_9tppikBxAE_G6qjWdBljBHJ
Channel (channel_id) UCU6JLYuerEUb7VrDd4zLihg

Youtube has another URL scheme like but the only way to get the RSS feed for it is to use YouTube’s API on the username. This is not the same as the user_id.

The Code

Nothing too exciting although I did learn about URL parsing using window.location and URLSearchParams.

const YOUTUBE_DOMAINS = ["","", ""];
const BASE_FEED_URL = "";
const pathArr = window.location.pathname.split("/");
const searchParams = new URLSearchParams(;
const playlistID = searchParams.get("list");

if (YOUTUBE_DOMAINS.indexOf(window.location.hostname) === -1) {
    completion("Non Playlist/Channel");
if (playlistID){
    let playlistFeedURL = `${BASE_FEED_URL}playlist_id=${playlistID}`;
} else {
    let basePath = pathArr[1];
    if(basePath === "channel") {
       let channelID = pathArr[2];
       let channelFeedURL = `${BASE_FEED_URL}channel_id=${channelID}`;
    } else if ("user" === basePath){
        let user = pathArr[2];
        let userFeedURL = `${BASE_FEED_URL}user=${user}`;
    } else {
      completion("Non Playlist/Channel");

Also note the completion function. This is needed to pass arguments along the shortcut.


You can discover the full shortcut here. Update 25 May 2021: It’s not live anymore and I plan on making a more robust version of this.