Turn YouTube into a Podcast Feed

While watching some YouTube videos, I got the idea, “I wish I could listen to these as a podcast while driving.” Digital Foundry’s Direct Weekly was a perfect example of this until recently (they have a podcast version now). Another good example was Hardware Unboxed’s monthly Supporter Q&As. Of course, someone already had the same idea and wrote a program called Podsync to take YouTube channels or playlists and create RSS feeds for use with your preferred podcast player. What’s even better is the setup of Podsync is simple to set up and run on your own server or cloud provider.

One thing of note: The official version of youtube-dl used by Podsync suffers from very slow downloads. A 30 minute YouTube video can take 10-15 minutes to download. One solution is to use the yt-dlp fork of youtube-dl. On GitHub, a developer named fqx has created a docker file that uses yt-dlp, and this guide will be using that image.

Requirements:

  1. A free YouTube API Key. This allows Podsync to programmatically get the data it needs instead of doing workarounds, like scraping web pages.
  2. A system capable of running Docker or compiling code written in the Go programming language. This can be a computer running Windows/Linux/MacOS, a NAS like Synology/QNAP/Unraid, or a cloud service like AWS/Digital Ocean.
  3. Podsync needs to be accessible from the public Internet. Apps like PocketCasts and Google Podcasts work by using their cloud services to read the RSS feeds and funnel the information to your device. While that makes it easier for you to listen from multiple devices, it also means you can’t have Podsync only accessible inside your private network.
  4. Your preferred podcasting app must support private or custom RSS feeds. This is similar to how creators at Patreon have RSS feeds for supporters. I recommend reading through this help article at Patreon to know what apps support custom feeds: https://support.patreon.com/hc/en-us/articles/115005429546-Which-podcast-apps-will-my-custom-audio-RSS-link-work-with-

Obtaining a YouTube API Key

  1. Go to https://console.developers.google.com/ with your Google account. Congratulations, you are now a developer (j/k).
  2. If you don’t already have one, create a new project by clicking the CREATE PROJECT link on the right.
    Google Cloud Dashboard
  3. Name the project whatever you want. In my case, I called it podsync-<random numbers>.
    Screenshot of creating a new Google Cloud project
  4. Now that a project has been created, APIs need to be enabled to access YouTube. At the top of the project dashboard, click the +ENABLE APIS AND SERVICES link.
    Screenshot showing project dashboard
  5. In the search bar, type YouTube Data API v3 and click on the result.
    Screenshot showing Cloud API search.
  6. Click on the ENABLE button to turn on access to the API for the project.
    Screeshot showing how to enable an API.
  7. The project created earlier should now have access to the YouTube API. Now an API key needs to be generated. Click the Create Credentials button near the top of the screen.
    Screenshot of the API overview page
  8. Select YouTube Data API v3 from the drop-down list, set the data access to Public data, and click the NEXT button.
    Screenshot showing how to select an API and select access type for YouTube.
  9. Take note of the API key and click the DONE button. The key will be needed later for the Podsync config.
    Screenshot showin the API key for the credentials created.

Podsync setup on Ubuntu 20.04 Server

For this guide, I am setting up Podsync using Docker on a server running Ubuntu 20.04 LTS. The exact configuration for your preferred platform may be different, so adjust the instructions accordingly

  1. Get the external IP address of the server. This will be needed for the podsync config.
    1. dig +short myip.opendns.com @resolver1.opendns.com
  2. Install Docker.
    1. sudo apt install docker.io
  3. Create a folder for Podsync’s config file and data to reside.
    1. sudo mkdir /opt/podsync
  4. Create a config file for Podsync in the folder created above. Below is a simple example. More options are available than this and can be found in the README file at Podsync’s Github repository.
    1. There are a few things you will need to decide:
      1. What channel/user/playlist do you want to turn into a RSS feed? You will need the http://www.youtube.com/channel/UID URL for the channel. https://www.youtube.com/c/CHANNELNAME does not work.
      2. How many videos do you want to download? I keep my RSS feeds short with only the last 5 videos selected.
      3. Do you want an audio or video format and do you want that media to be high or low quality? I’m using audio with high quality.

sudo nano /opt/podsync/config.toml

[server]
port = 8080
data_dir = "/app/data"
hostname = "http://EXTERNALIPADDRESS:8080"

[tokens]
youtube = "YOUTUBE_API_TOKEN"

[feeds]
  [feeds.ID1]
  url = "{FEED_URL}" # URL address of a channel, group, user, or playlist. 
  page_size = 5
  update_period = "12h"
  quality = "high" # or "low"
  format = "audio" # or "video"

[database]
  badger = { truncate = true, file_io = true } # See https://github.com/dgraph-io/badger#memory-usage

[downloader]
self_update = true # Optional, auto update youtube-dl every 24 hours
timeout = 15
  1. Install and start Podsync in Docker.
sudo docker run -d \
--name podsync \
-p 8080:8080 \
-v /opt/podsync/data:/app/data/ \
-v /opt/podsync/config.toml:/app/config.toml \
--restart unless-stopped \
ghcr.io/fqx/podsync-with-yt-dlp:latest
  1. Use Docker’s logs feature to watch the progress of Podsync.
    1. sudo docker logs podsync --follow
      Screenshot of the STDOUT output of podsync in docker
  2. A new website should be accessible from the server’s IP address on port 8080. Try to visit the site from your computer. If you do not know the IP address of your server, try the command ip address to get a list of interfaces and their corresponding addresses.
    Screenshot of Podsync's website

Make Podsync Internet Accessible

If you are running Podsync from a server in your local network, port forwarding will need to be set up to make it accessible from the Internet. The instructions will vary for the type of router you have, and I will not detail how to do this.

Once port forwarding is set up, you should be able to access Podsync by using the public IP address of your network. If you do not know the public IP address, run the following command from the server dig +short myip.opendns.com @resolver1.opendns.com .

Subscribe to the RSS Feeds

The final step is to take the URL for the XML files hosted by Podsync and subscribe to them in your preferred podcasting app. As mentioned above in the requirements section, not all apps work with custom RSS feeds. Patreon has a great list of compatible apps and guides to setting them up.

Have fun,
Tony