This script monitors RSS feeds and can send new entries as Jabber messages or execute pre-defined command against links in new messages on the feed. It designed specifically with Youtube RSS in mind, but might also work with other feeds.
Development in this repository is now stopped in favor of rewrite in a separate progect, https://github.com/15532th/avtdl, allowing more flexible configuration and introducing support for monitoring additional sources.
It should work with Python version 3.6 and higher.
Clone or unzip this repo to appropriate folder.
Install dependencies from requirements file:
pip3 install --user -r requirements.txt
Settings are stored in YAML
format in config.yml
. As a starting poing, config.yml.example
is provided. Rename it to config.yml
and adapt for your needs.
loglevel
: how detailed script messages should be. Can be "DEBUG", "INFO" or "WARNING"ua
: useragent to make requests with. If not specified default from urllib is used.db_path
: to preserve state between runs, all messages from RSS feeds are stored in a file. Can be ommited.update_interval
: how often RSS feeds should be updated in minutes.send_interval
: how often pending Jabber notifications will be send in minutes.xmpp_username
andxmpp_pass
: Jabber credentials to send notifications fromdownload_command
: command that will be executed to download url from feed. Placeholder{url}
will be replaced with url field from RSS feed message. Command will be executed as subprocess, so typical shell commands characters won't work.
feeds:
feed1: "url1"
feed2: "url2"
Names such as feed1
are arbitrary and used in users
section.
Currently, url for RSS feed on Youtube channel is https://www.youtube.com/feeds/videos.xml?channel_id=...
.
Common structure:
users:
username1:
...
username2:
...
usernameN:
...
Possible options for specific user:
xmpp_username
: JID to send messages about feeds listed in actions for this usertimezone_offset
: used to recalculate timestamps to local time in Jabber messages. All timestamps are internally stored in UTC
users:
username1:
xmpp_username: "[email protected]"
timezone_offset: -7
feeds:
- feed1:
...
- feed2:
...
Options for feeds
section of specific user:
save_path
: work directory fordownload_command
subprocess when called for this specific feed and usersend_errors
: send Jabber message to user ifdownload_command
subprocess finished with non-zero exit codeactions
: how to handle new entries on RSS feed for specific userfilter
: only process entry if it has specified pattern in it, case-insensitive
users:
username1:
xmpp_username: "[email protected]"
feeds:
- feed1:
actions:
- send_any
- download_any
filter:
- "archive"
- "sing"
save_path: "absolute/path/to/store/files/"
send_errors: true
Possible actions
:
send_any
: send user Jabber message about new entry in RSS feedsend_unarchived
: same as above, but only if title hasarchive
in itdownload_any
: start downlad subprocess for an url from new entry in RSS feeddownload_unarchived
: same as above, but only if title hasarchive
in it
Note, that it's possible to have multiple sets of feed options for a single link by specifying same feed twice:
users:
username1:
xmpp_username: "[email protected]"
feeds:
- feed1:
actions:
- send_any
- feed1:
filter:
- "unarchived"
actions:
- download_any
save_path: "absolute/path/to/store/files/"
Start rss2jbr
module with your python interpreter.
python3 rss2jbr