ytdl2rss¶
Create podcast RSS of media downloaded from YouTube, Vimeo, Twitch or any other site supported by youtube-dl (or yt-dlc, yt-dlp, or other forks).
Introductory Example¶
To create an audio podcast from videos in GoogleTechTalks Make the Web Faster playlist:
youtube-dl --write-info-json --no-clean-info-json -f bestaudio https://www.youtube.com/playlist?list=PLE0E03DF19D90B5F4
ytdl2rss *.info.json >podcast.rss
Features¶
Installation¶
This package can be installed using Python package managers (pip, pipx, uv, conda, pixi, etc.), in the usual ways. For example, by running:
pip install ytdl2rss
Or by saving src/ytdl2rss/__init__.py as ytdl2rss.py in $PATH and,
on Unix-like platforms, making it executable (chmod +x ytdl2rss.py).
Recipes¶
Periodic Updates¶
A podcast can be periodically updated by running youtube-dl and ytdl2rss
from cron. Using --download-archive is recommended. For example, to
update the introductory example daily at 5 a.m., the following can be added to
crontab:
0 5 * * * cd path/to/podcast && youtube-dl --download-archive ytdl-archive.txt --write-info-json --no-clean-info-json -f bestaudio https://www.youtube.com/playlist?list=PLE0E03DF19D90B5F4 && ytdl2rss *.info.json >|podcast.rss
Hosted Thumbnails¶
Episode thumbnail images can be hosted alongside downloaded media, so
podcatchers will not download them from the original host, by using
--write-thumbnail and modifying the .info.json files to use the
downloaded thumbnails:
youtube-dl --write-info-json --no-clean-info-json --write-thumbnail -f bestaudio https://www.youtube.com/playlist?list=PLE0E03DF19D90B5F4
for info in *.info.json; do
jq --arg t "${info%.info.json}.webp" '.thumbnail = $t' "$info" >"$info.new"
mv -f "$info.new" "$info"
done
ytdl2rss *.info.json >podcast.rss
See contrib/ytdl-thumbnails.sh for an example that includes conversion from WebP to JPEG.
Podcast Metadata¶
In addition to JSON for individual videos, ytdl2rss accepts JSON for
playlists (produced by youtube-dl --print-json for channel/playlist/user
URLs). This can be used to define a podcast metadata not currently saved by youtube-dl, such as a description, thumbnail, and webpage URL. To
combine info JSON into a playlist with custom metadata:
jq -s \
--arg desc "My awesome podcast." \
--arg thumb "channel_thumbnail.jpg" \
--arg url "http://example.com/podcast-home.html" \
'{
_type: "playlist",
entries: .,
# Copy playlist metadata from info for first video
id: .[0].playlist_id,
title: .[0].playlist_title,
uploader: .[0].playlist_uploader,
uploader_id: .[0].playlist_uploader_id,
# Add custom playlist metadata
webpage_url: $url,
description: $desc,
thumbnail: $thumb
}' ./*.info.json | ytdl2rss - >|podcast.rss
See contrib/ytdl-playlist-meta.sh for an example which gets playlist metadata from Open Graph Metadata in the playlist HTML.