PingTube is a lightweight Python service that monitors YouTube channels via their RSS feeds and automatically posts new video links to a Discord webhook.
It is designed for self-hosting on Linux and runs as a systemd service.
- Monitors any number of YouTube RSS feeds
- Posts new uploads to a Discord webhook
- Keeps track of what has already been posted (no duplicates)
- Ignores all videos published before the service was started
- Saves basic statistics about detected videos
- Simple JSON configuration
- Runs as a background service on Linux
PingTube has so far only been tested on Ubuntu 24.04.
It should work on other Debian/Ubuntu-based systems, but this has not been verified.
- On the first run, PingTube records the current time for each feed (
first_seen
). - It never posts videos published before that time.
- Every interval (default 5 minutes), it checks the feeds and posts links to any new videos published since
first_seen
. - Detected videos are logged to a file and stored in
seen.json
.
- Python 3.8+
pip
andvenv
- Linux with
systemd
- A Discord webhook (see below)
PingTube uses a Discord webhook to send messages to a channel.
To create one:
- Go to your Discord server settings
- Choose Integrations → Webhooks
- Create a webhook, copy the webhook URL, and paste it into your
config.json
The configuration file is config.json
, located in the same folder as pingtube.py
.
Example:
{
"interval_seconds": 300,
"discord_webhook_url": "https://discord.com/api/webhooks/....",
"feeds": [
"https://www.youtube.com/feeds/videos.xml?channel_id=UCxxxx",
"https://www.youtube.com/feeds/videos.xml?channel_id=UCyyyy"
]
}
- interval_seconds: how often (in seconds) feeds are checked
- discord_webhook_url: Discord webhook to post messages
- feeds: list of RSS URLs (one per channel)
To easily get the correct RSS feed URL for a YouTube channel, use:
./youtube_channel_rss.sh
It will ask for a YouTube channel URL (such as https://www.youtube.com/@LinusTechTips
)
and return something like:
Channel ID : UCXuqSBlHAE6Xw-yeJA0Tunw
RSS feed : https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw
You can then copy the RSS feed URL and paste it into the feeds list in your config.json.
An install script is provided: install_pingtube_service.sh
.
Run:
chmod +x install_pingtube_service.sh
./install_pingtube_service.sh
This will:
- Create /opt/pingtube
- Create a Python virtual environment and install dependencies
- Set up a systemd service (pingtube.service)
- Create a log directory /var/log/pingtube
- Add a logrotate configuration
- Enable and start the service
Logs are stored in:
/var/log/pingtube/pingtube.log
and rotated automatically by logrotate
.
Follow logs live with:
sudo journalctl -u pingtube.service -f
seen.json
: tracks which videos have been postedstats/
: stores simple JSON stats files with counts
To add a new YouTube channel:
- Use the helper script
youtube_channel_rss.sh
to get the correct RSS URL - Add the resulting RSS URL to
config.json
- Restart the service:
sudo systemctl restart pingtube.service
This is a very small tool I made for my own use as a Linux administrator.
I am not a developer, and this was just a small side project to solve a simple problem.
I do not plan to add many features or maintain it as a full software project.
Feel free to use it if it solves your problem, or ignore it if it doesn't.
Pull requests or suggestions are welcome, but this is meant to be a simple, no-fuss solution.
It "pings" Discord with new YouTube uploads.
I originally tried some existing software for this task, but I couldn’t get any of them to work.
So I built this for fun and to help out a friend who needed a simple solution.
This is free and unencumbered software released into the public domain.
For more information, please refer to https://unlicense.org