Metadata-Version: 2.1
Name: ytpodgen
Version: 0.1.1
Summary: turns YouTube live streams into podcasts
Author: harupong
Author-email: harupong@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: click (>=8.1.3,<9.0.0)
Requires-Dist: loguru (>=0.6.0,<0.7.0)
Requires-Dist: requests (>=2.28.2,<3.0.0)
Description-Content-Type: text/markdown

# 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
### watch for new livestream, 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}
```

Since this might take a while, I'm running this in background using `screen`.

### Why not upload them as well!?
You can pass `--upload` 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 watches 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 --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.

## how it works
(default)1. watch for and download YouTube live in mp4 format, then convert to mp3, with yt-dlp and ffmpeg
(default)2. generate Podcast-compatible RSS file, with dropcaster
(optional)3. upload RSS/mp3 files to S3-compatible storage, with rclone

## TODO
- [ ] use `boto3` for uploading files
- [ ] package this app using `setuptools` so that I can install this using `pip`
    - example https://github.com/aws/aws-elastic-beanstalk-cli
    - install under `~/.local/bin/` and `~/.local/share/ytpodgen/`
    - either [Fire](https://google.github.io/python-fire/) or [Click](https://click.palletsprojects.com/en/8.0.x/)
