Sync YouTube channel subscriptions to miniflux
- Python 100%
| .gitignore | ||
| .python-version | ||
| LICENSE | ||
| main.py | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
youtube2miniflux
Sync YouTube channel subscriptions to a Miniflux category. Some nerd skills required.
Generate a JSON list of subscriptions
Visit Subscriptions > All channels page
Open a Developer console and paste...
// from: https://www.wezm.net/v2/posts/2024/youtube-subscriptions-opml/
copy(JSON.stringify(Array.from(new Set(Array.prototype.map.call(document.querySelectorAll('a.channel-link'), (link) => link.href))).filter((x) => !x.includes('/channel/')), null, 2))
Channels are copied to clipboard, paste them into subscriptions.json inside the project directory.
Configuration
Create an .envrc (for direnv), or otherwise export into your environment...
export MINIFLUX_URL=https://miniflux.addr/
export MINIFLUX_API_KEY=abc123
export MINIFLUX_CATEGORY_ID=42
# "Channel" for everything, "Videos" to exclude shorts and livestreams
export YT_PREFERRED_FEED=[Channel|Videos|Short videos|Live streams]
Run the script
With uv
Ugh, yes, uv is owned by OpenAI now. Gotta get a new Python packaging habit.
cd /path/to/youtube2miniflux
uv run main.py
With Python 3.12+ and a venv
# bash assumed, but if you're using fish too, you know what to do
cd /path/to/youtube2miniflux
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
python3 ./main.py
Data gathered from YouTube is cached between runs to speed things up and avoid unnecessary hits when running the script repeatedly. For now there's no refresh mechanism built-in. The cache is in a platform-appropriate place if you want to just trash it... ~/.cache/youtube2miniflux/subscriptions-data.json on Linux.