Package: ytpodgen
ytpodgenCommand line tool to turn YouTube live streams into podcasts. It watches out for new YouTube live streams, and once on the air, records the livestream, converts it to audio file, generates podcast RSS, and uploads them to Cloudflare R2.prerequisitepython3 and pipTested only on Mac and Linux.first time setuppython3 -m pip install --user ytpodgenSet environment variableSLACK_WEBHOOK_URL, if you want Slack notification.If you want to upload files to Cloudflare R2 as well, don't forget to set three environment variables for Cloudflare R2.R2_ENDPOINT_URLR2_ACCESS_KEY_IDR2_SECRET_ACCESS_KEYFor now, R2 bucket name must bepodcast.usageusage: ytpodgen [-h] --title TITLE --hostname HOSTNAME [--liveurl LIVEURL] [--upload-r2] [--output OUTPUT] [--bucket BUCKET] [--private] [--version]

Podcast generator

options:
  -h, --help           show this help message and exit
  --title TITLE        title for the podcast
  --hostname HOSTNAME  hostname(custom or r2.dev) to serve files
  --liveurl LIVEURL    Watch for and download the specified YouTube Live URL.
  --upload-r2          If specified, upload mp3s/RSS to Cloudflare R2.
  --output OUTPUT      Output directory(default: current directory)
  --bucket BUCKET      R2 Bucket name to upload files(default: podcast)
  --private            If specified, make the podcast private by generating hashed url.
  --version            Show version and exit.examplesMY USE CASE: wait for new livestream in background, and once on the air, record it, generate podcast RSS, and upload them to Cloudflare R2screen -dmS <TITLE> ytpodgen --liveurl <LIVEURL> --title <TITLE> --hostname <HOSTNAME> --upload-r2When completed,ytpodgenwill wait for another livestream. Since all the waiting might take a while, I prefer running this in background usingscreen.a few options you might wanna take a look atprivateWhen you want to make a podcast private, using basic auth to restrict access is the best way to go. However, it requires additional setup, and some podcast apps don't support basic auth.By passing this option, you can generate hashed url for the podcast. It is far less secure than basic auth, but it is easier to setup, and it works with most podcast apps.I'm using this option to sync audiobook files to the podcast app on my Garmin smartwatch.bucket BUCKETBy default,ytpodgenuploads files topodcastbucket. If you want to upload files to a different bucket, you can specify it with this option.I'm using this option to switch between a bucket that is password protected by basic auth, and a bucket that is not.  Be careful what to pass to the--hostnameoption when you use this option, as the hostname must match the bucket name.I just want to generate RSS from mp3 files, no download/upload neededytpodgen --title <TITLE> --hostname <HOSTNAME>This generatesindex.rssfile from the mp3 files in current directory and exits.How to releaseExecuting the commands below, and the GitHub Actions publishes new package to PyPI.poetryversion<patch/minor/major>
gitaddpyproject.toml&&gitcommit-m$(poetryversion-s)gitpushoriginmain
ghreleasecreate--generate-notes"v$(poetryversion-s)"gitfetch--tagsoriginWhy only Cloudflare R2, and not other S3-compatible cloud storage?Because:It offers free tier for up to 10GB of storage space per monthWith Cloudflare Worker, basic auth can be applied to the uploaded files that are made publichow I configured basic auth on Cloudflare R2 using Cloudflare Workersconnected a custom domain to my R2 bucket, to make the bucket public.docsconfigured a basic auth worker by following steps describedhere.replaced the plaintext declaration of password with worker env var.docsadded a trigger(custom domain route) to the basic auth worker.docsTODO/IDEASmoved toGitHub issues