Podcast generator from YT channels
The objective of this project is to create a podcast feed generator from YT channels. It automatically downloads videos from specified channels, converts them into audio files, and generates an RSS feed for podcast distribution.
To clone the repository and run the project locally, follow these steps:
git clone https://github.com/rubenmartinm/yt-podcast.git
cd yt-podcast
Copy the .env-example
and add your values:
cp .env-example .env
Edit with your values:
MY_WEBSERVER_IP: '<YOUR IP>' # Most probably with ifconfig eth0
MY_WEBSERVER_PORT: '<YOUR DESIRED PORT>'
UID: '1000' # You can run id to get theese
GID: '1001'
Copy the yt_channels.example.yaml
and add your values:
cd config
cp yt_channels.example.yaml yt_channels.yaml
Edit with your values. This can be an example:
podcasts:
PantomimaFull:
youtube_channel: https://www.youtube.com/@PantomimaFull/videos
image_url: https://yt3.googleusercontent.com/j3FWuqRMzLhTGBxWnrlhxatpmaTXvFuNM6oYIoIE7iHNoQChlxhz7hi2Wweu3SxRJaUxG1eM=s176-c-k-c0x00ffffff-no-rj
total_videos: 1
Back to the main directory:
cd ..
A web server image is provided to serve the generated RSS feeds and audio files. Run the following command to start the web server:
docker-compose up nginx -d
[+] Running 2/2
✔ Network yt-podcast_default Created 0.0s
✔ Container nginx Started 0.1s
You can check if the container is running with:
docker-compose ps nginx
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
nginx nginx:latest "/docker-entrypoint.…" nginx 28 hours ago Up 8 minutes 0.0.0.0:9999->80/tcp, :::9999->80/tcp
The video downloader image needs to be executed periodically to download new videos. Use the following command to run the video downloader:
docker-compose up yt-podcast -d
[+] Running 1/1
✔ Container yt-podcast Started 0.0s
You can check if the container is running with:
docker-compose ps yt-podcast
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
yt-podcast ghcr.io/rubenmartinm/yt-podcast:latest "python main.py" yt-podcast About a minute ago Up About a minute
Additionally, you can check the execution with:
docker-compose logs yt-podcast -f
...
To schedule execution of the downloader you can use like this:
EDITOR=vi crontab -e
# YT-Podcast
# This will execute everyday at 06:00 and 18:00
# You can use https://crontab.guru to create a valid expression
0 06,18 * * * cd /<YOUR_GLOBAL_PATH>/yt-podcast && docker-compose up yt-podcast > /dev/null 2>&1
To configure your podcast client to access the generated RSS feeds, follow these steps:
- Open your podcast client.
- Add a new podcast subscription.
- Enter the URL of the RSS feed generated by the web server.
- Most likely will be this one:
http://<MY_WEBSERVER_IP>:<MY_WEBSERVER_PORT>/<CHANNEL_NAME>_feed.xml
- Save the subscription.
Note: If accessing the service from outside your home network, you may need to set up a tunnel using WireGuard or another VPN solution to avoid exposing the service directly to the internet.
Additionally, you can check the logs to see the if the Podcast Client is reaching your Web Server with:
docker-compose logs nginx -f
...
You just have to stop the containers and remove the yt-downloader
directory:
docker-compose down
cd ..
rm -r yt-podcast
- Implement a background daemon in the video downloader image to automate the scraping process and download new videos as they become available.