RSS feed parser sending entries as embeds via webhooks to Discord Channels
git clone https://github.com/Mmesek/RSSReader.git
cd RSSReader
python -m pip install -r requirements.txtFeeds & Webhooks are stored in database
Database configuration can be specified as either connection string as environment variable DATABASE_URL:
Unix/Shell:
set DATABASE_URL="postgresql+psycopg2://postgres:PASSWORD:5432/public"Windows/Powershell:
$env:DATABASE_URL = "dialect+driver://user:PASSWORD:port/database"Note that environment variable is temporary (until terminal session is closed)
or as config.ini with flag --cfg=config.ini:
[Database]
db = postgresql+psycopg2
user = postgres
password = PASSWORD
location = 127.0.0.1
port = 5432
name = publicThere are stored tracked feeds:
URLto feed.last_postbeing a timestamp of last entry in this feed.refresh_ratewhen set, it won't attempt to fetch this feed again unless it's changed. Set to 0:00:00 to disable.
Processing of feeds for each entry can be customized there. Available components can be found in processors.py
This is many-to-many relationship between Feed and Webhook tables.
Webhook's ID and Token are stored here
Whole package is a run-once script, therefore if you want to run it more often, you'll need to setup cronjob to start it manually
Run once:
python -m RSSAs a cronjob at 15m interval:
*/15 * * * * python -m RSSAlternatively if you deploy to Heroku, you can trigger it by restarting (deleting) Dyno with curl request:
curl -n -X DELETE https://api.heroku.com/apps/{APP_NAME}/dynos -H "Content-Type: application/json" -H "Accept: application/vnd.heroku+json; version=3" -H "Authorization: Bearer {TOKEN}"Code has been tested in production against PostgreSQL. Free tier on either Heroku or Supabase should be well more than enough for simple use case.
MySQL was tested in limited capacity and requires code modifications:
- Removing
.filter()fromFeed.get()method - Adding length to all string based columns in
models.pyby replacingsa.Stringwith for examplesa.String(100) - Due to lack of
Intervaltype,refresh_ratemay not work there