Skip to main content

turns YouTube live streams into podcasts

Project description

ytpodgen - turns YouTube live streams into podcasts

prerequisite

  • python3 and pip
  • docker(for dropcaster and yt-dlp)
  • rclone

first time setup

pip3 install --user ytpodgen

Set environment variable SLACK_WEBHOOK_URL, if you want Slack notification.

If you want to upload files as well, don't forget to configure rclone remote for Cloudflare R2. For now, remote name must be cloudflare and bucket name must be podcast.

examples

wait for new livestream, and once on the air, record it and generate podcast RSS in background

TITLE=<title>
LIVEURL=<liveurl> #youtube live url
HOSTNAME=<hostname> #hostname to serve files from
screen -dmS ${TITLE} ytpodgen --liveurl ${LIVEURL} --title ${TITLE} --hostname ${HOSTNAME}

When completed, ytpodgen will wait for another livestream. Since all the waiting might take a while, I prefer running this in background using screen.

Why not upload them as well!?

You can pass --upload-r2 argument to enable file uploadig to Cloudflare R2. By enabling it, mp3s/RSS are uploaded to Cloudflare R2.

For example, by running the commands below , you create a screen session that waits for YouTube livestream on the given URL and saves the data under current directory if there is a livestream.

TITLE=<title>
LIVEURL=<liveurl> #youtube live url
HOSTNAME=<hostname> #hostname to serve files from
screen -dmS ${TITLE} ytpodgen --upload-r2 --liveurl ${LIVEURL} --title ${TITLE} --hostname ${HOSTNAME}

I just want to generate RSS from mp3 files, no download/upload needed

TITLE=<title>
HOSTNAME=<hostname> #hostname to serve files from
ytpodgen --title ${TITLE} --hostname ${HOSTNAME}

This generates index.rss file under current directory and exits.

Why only Cloudflare R2, and not other S3-compatible cloud storage?

Because:

  • It offers free tier for up to 10GB of storage space per month
  • With Cloudflare Worker, basic auth can be applied to the uploaded files that are made public

TODO

  • use boto3 for uploading files in order to remove rclone
  • generate rss feed with python code in order to remove dropcaster
  • embed yt-dlp into ytpodgen, instead of calling it via docker
  • use --live-from-start option for yt-dlp if the stream has already started
  • package this app using poetry so that I can install this using pip
  • introduce Click for this project

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ytpodgen-0.1.3.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

ytpodgen-0.1.3-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page