This Python script monitors Git Release RSS feeds and sends notifications to a Discord webhook when new updates are published. It uses a configuration file for easy management of RSS URLs and the Discord webhook URL.
- RSS Feed Monitoring: Checks multiple RSS feeds at a specified interval.
- Discord Webhook Integration: Sends notifications to a Discord channel via a webhook.
- Post Caching: Prevents duplicate notifications by caching processed post IDs.
- Configurable RSS URLs and Webhook: Uses a
config.inifile for easy configuration. - Post Age Filtering: Only sends notifications for posts published within a specified time frame.
- Python 3.6 or higher
feedparserlibraryrequestslibraryconfigparserlibrarypython-dateutillibrary
-
Clone the repository:
git clone https://github.com/stanrc85/discorss.git cd discorss -
Install the required Python libraries:
pip install -r requirements.txt
Confirmed works with GitHub and Gitea release RSS feeds.
-
GitHub
Go to the repository
releasespage and then add.atomto the URL to view the RSS feed. Add that URL in theconfig.ini. -
Gitea
Go to the repository
releasespage and then click the RSS feed icon. Add that URL in theconfig.ini. -
Create
config.ini:Copy
config.ini.exampletoconfig.iniand modify as needed:[RSS] urls = https://example.com/rss1 https://example.com/rss2 [Discord] webhook_url = YOUR_DISCORD_WEBHOOK_URL [General] # Check for updates every 300 seconds, set to 0 to run once and then quit (when using in a scheduled task) CHECK_INTERVAL = 300 # Only alert on posts younger than 1 day. MAX_POST_AGE_DAYS = 1
- Add your RSS feed URLs under the
[RSS]section, one per line. - Replace
YOUR_DISCORD_WEBHOOK_URLwith your actual Discord webhook URL. - Configure
CHECK_INTERVALandMAX_POST_AGE_DAYSas desired.
- Add your RSS feed URLs under the
-
Run the script:
python discorss.py
-
The script will run continuously, checking the RSS feeds at the specified interval and sending notifications to your Discord channel.
To run the script as a background service:
- Linux/macOS: Use
nohuporscreenorsystemdorpm2. - Windows: Use Task Scheduler.
Example using nohup (Linux/macOS):
nohup python discorss.py &- Build the Docker image
Open a terminal in the directory containing the Dockerfile and run:
docker build -t discorss .- Run the Docker container
You can now run the Docker container using the following command:
docker run -d --name discorss \
-v $(pwd)/config.ini:/app/config.ini \
-v $(pwd)/rss_cache.json:/app/rss_cache.json \
discorssSet CHECK_INTERVAL = 0 in config.ini
- Edit crontab
crontab -e- Add new entry
Run script every hour
0 * * * * python discorss.py