A self-hosted application that lets you create podcast RSS feeds from YouTube playlists.
Takes a list of YouTube playlists and:
- Downloads all the videos in audio only format (best quality)
- Generates an RSS XML feed and writes it to a file so that the audio files can be used/read by podcast apps
The generated RSS XML file is located at
podcasts_path/playlist_title/podcast.xml
.
If the playlist title has special characters, p2p makes the name safe for
filesystems, so will change and/or remove special characters from the directory
name. To get the directory name, the easiest way is to either ls
your podcast
directory or look in the logs.
This does not actually host the downloaded/created files, you will need a static web server for that, I reccomend Caddy or nginx.
The directory you want to serve is the same one that you put as the
podcasts_path
config variable.
Once you have that setup you can simply put the URL to each generated
podcast.xml
into your chosen podcast app, for example
https://podcasts.example.com/test/podcast.xml
where test
is the name of the
directory that p2p saved a podcasts data to.
The requirements in requirements.txt
need installing first, you can do this your own way or by doing pip install -r requirements.txt
.
Run p2p with python main.py
, or see below for Docker.
Once running p2p will check for playlist updates once every 24 hours.
p2p will look for a config.yaml
file where it is run, if running in Docker you
will want to mount it in /app
, like so:
-v $(pwd)/config.yaml:/app/config.yaml:ro
Here's what the contents should look like:
# The URL that you are going to be hosting the podcast files at.
host_base_url: "https://podcasts.example.com/"
# The path (either on your system or inside the Docker container) that will contain the podcast data.
podcasts_path: "/podcasts"
# The date since to download videos. Will download only videos uploaded on or after this date.
# The date can be "YYYYMMDD" or in the format "(now|today)[+-][0-9](day|week|month|year)(s)?"
# (see "dateafter" on https://github.com/yt-dlp/yt-dlp#general-options for more info).
# Optional parameter: skip it or set empty to download all videos.
dateafter: "today-6months"
# The list of playlists to download and host. MUST be playlist URLs, NOT video URLs.
podcasts:
- "https://www.youtube.com/playlist?list=PLTLwdZqDsAvtGmVvJqRS2czLq2YZ_ZHPJ"
Example run command:
docker run -d --name p2p --restart unless-stopped \
-v $(pwd)/config.yaml:/app/config.yaml:ro \
-v $(pwd)/podcasts:/podcasts \
psidex/playlist2podcast
Don't forget if you're using the Docker build, podcast_path
in config.yaml
should reference the path inside the container, not outside it.
Uses yt-dlp to download the playlists and feedgen to create the RSS XML.