Skip to content

Tiny Python 3 RSS reading script to get notifications (using ntfy) of new posts.

License

Notifications You must be signed in to change notification settings

Kariton/rss-ntfy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RSS ntfy

Very small RSS notifier using ntfy.
Forked from julianorchard/rss-ntfy and mostly rewritten to add furhter functionality.

I would highly recommend using a self hosted ntfy instance, so that you can use whatever ntfy names you want.

Each post from a feed gets send as Markdown text.
In order to avoid duplicate posts, the "link" extracted from the RSS items is stored in a _hist file and
subsequently deleted once they are no longer present in the feed.
Some feeds might cause reposts because they re-include "old" listings.

Usage

Installation

pip install -r requirements.txt
mkdir /etc/rss-ntfy/
cp ./config/config.yml /etc/rss-ntfy/config.yml

Alternatively, use Docker compose:

docker compose up

This will create a persistent volume for the storage of the _hist files, too (at least per default).

Configuration

The script includes a set of default service definition and configuration which you might want to change.

default.yml defines a set of feeds, services, global settings and config. [DONT EDIT]
Snippet:

---

global:                                                         # settings to use as defaults
  ntfy_server: https://ntfy.sh                                  # server to use if no other is defined on service level
  [...]
  
services: # service definition
  github_release:                                               # service name - referenced within the 'feeds' definition
    service_feed: https://github.com/{{ name }}/releases.atom   # where the rss feed is located
    service_url: https://github.com/{{ name }}                  # used in the subtitle to link to the feed
    ntfy_icon: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
    ntfy_subtitle_prefix: 🤖 GitHub Release
    ntfy_subtitle_seperator: by
    ntfy_tags: ['robot']

  github_commit:
    service_feed: https://github.com/{{ name }}/commits.atom
    service_url: https://github.com/{{ name }}
    ntfy_icon: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
    ntfy_subtitle_prefix: GitHub Commit on
    ntfy_subtitle_seperator: by
    ntfy_tags: ['robot']
  [...]
  
feeds: # feeds to monitor from those services
  github_release: []
  github_commit: []
  [...]

config:
  cache_location: /data
  run_on_startup: false
  log_level: info
  schedule: '*/30 * * * *'                                      # crontab style expression - concurrent jobs are not possible
  service_wait: 60                                              # time to wait between services
  feed_wait: 5                                                  # time to wait between posts of one feed
  max_message_size: 4096                                        # max size of message for pagenation
  max_attempts: 3                                               # retry to send message; consider failed after
  retry_wait: 30                                                # time to wait between retrys

To personalize your rss ntfycations you can override / extend those defaults with a config.yml:
With Docker: Don't mount the file directly and instead mount the whole config directory, otherwise automatic reload does not work.
Without Docker: The script expects the config to be available at /etc/rss-ntfy/config.yml

---

global:
  ntfy_topic: some_topic                                        # topic to use if no other is defined on service level

feeds:
  reddit_subreddit:
    - SysadminHumor+Programmerhumor
  youtube:
    - name: UCXuqSBlHAE6Xw-yeJA0Tunw
      feed_display_name: LTT                                    # the subtitle takes the feed name - which in some cases, like YouTube, is an ID

services:
  reddit_subreddit:
    ntfy_topic: one_topic

  reddit_subreddit:
    ntfy_topic: another_topic

At this point the contents of the handlebar type substitutions ({{ }} in services) don't matter;
this will be replaced with the users/thing-you-want-to-follow.

Changes are validated and applyied dynamicly. A reload / restart is not nessesary.

License

Under the MIT License. See license file for more information.

About

Tiny Python 3 RSS reading script to get notifications (using ntfy) of new posts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.3%
  • Dockerfile 2.7%