Skip to main content

Forward links from RSS/Atom feeds to messengers

Project description

FeedForBot

PyPI PyPI Docker Pulls Ruff

Monitors RSS/Atom feeds on a cron schedule and forwards new entries to Telegram. Supports multiple feeds, Jinja2 message templates, file-based caching to avoid duplicate sends, and optional Sentry integration.

Installation

Requires Python 3.14+.

pip install feedforbot -U

For the CLI (includes Click, structlog, YAML config, Sentry):

pip install "feedforbot[cli]" -U

Quick start

As a library

from feedforbot import Scheduler, TelegramBotTransport, RSSListener

scheduler = Scheduler(
    '*/5 * * * *',
    listener=RSSListener('https://www.debian.org/News/news'),
    transport=TelegramBotTransport(
        token='123456789:AAAAAAAAAA-BBBB-CCCCCCCCCCCC-DDDDDD',
        to='@channel',
    ),
)
scheduler.run()  # blocks, checks the feed every 5 minutes

Async version — useful when running multiple schedulers or combining with other async tasks:

import asyncio

from feedforbot import Scheduler, TelegramBotTransport, RSSListener

scheduler = Scheduler(
    '*/5 * * * *',
    listener=RSSListener('https://www.debian.org/News/news'),
    transport=TelegramBotTransport(
        token='123456789:AAAAAAAAAA-BBBB-CCCCCCCCCCCC-DDDDDD',
        to='@channel',
    ),
)

asyncio.run(scheduler.arun())

CLI with YAML config

Create a config.yml:

---
cache:
  type: 'files'
schedulers:
  - rule: '*/5 * * * *'
    listener:
      type: 'rss'
      params:
        url: 'https://habr.com/ru/rss/all/all/?fl=ru'
    transport:
      type: 'telegram_bot'
      params:
        token: '123456789:AAAAAAAAAA-BBBB-CCCCCCCCCCCC-DDDDDD'
        to: '@tmfeed'
        template: |-
          <b>{{ TITLE }}</b> #habr
          {{ ID }}
          <b>Tags</b>: {% for category in CATEGORIES %}{{ category }}{{ ", " if not loop.last else "" }}{% endfor %}
          <b>Author</b>: <a href="https://habr.com/users/{{ AUTHORS[0] }}">{{ AUTHORS[0] }}</a>
  - listener:
      type: 'rss'
      params:
        url: 'http://www.opennet.ru/opennews/opennews_all.rss'
    transport:
      type: 'telegram_bot'
      params:
        token: '123456789:AAAAAAAAAA-BBBB-CCCCCCCCCCCC-DDDDDD'
        to: '@tmfeed'
        disable_web_page_preview: yes
        template: |-
          <b>{{ TITLE }}</b> #opennet
          {{ URL }}

          {{ TEXT }}

Run:

feedforbot --verbose config.yml

On the first run the cache is populated without sending messages, so existing feed entries won't flood the channel.

Docker

docker run -v $(pwd)/config.yml:/config.yml \
  ghcr.io/shpaker/feedforbot --verbose /config.yml

Also available on Docker Hub:

docker run -v $(pwd)/config.yml:/config.yml \
  shpaker/feedforbot --verbose /config.yml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feedforbot-4.0.0rc4.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

feedforbot-4.0.0rc4-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file feedforbot-4.0.0rc4.tar.gz.

File metadata

  • Download URL: feedforbot-4.0.0rc4.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for feedforbot-4.0.0rc4.tar.gz
Algorithm Hash digest
SHA256 31c3170be7edcd1820b9a76a96dcc60d1fb32c3312198f79dc99b9dee516c079
MD5 37bed5459ee10d816233ffd3e9653548
BLAKE2b-256 6e4e6a10a56f2b2f4b1251282045002b8a7beed0ebb166fbd904b9310c8f90db

See more details on using hashes here.

File details

Details for the file feedforbot-4.0.0rc4-py3-none-any.whl.

File metadata

  • Download URL: feedforbot-4.0.0rc4-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for feedforbot-4.0.0rc4-py3-none-any.whl
Algorithm Hash digest
SHA256 f530dcc58d9458426a2b7e14296ae62e05e6714e99ef683b2bd00e17541bdc84
MD5 ba0d2613603b90e99f4aedc21cf2ba52
BLAKE2b-256 3ee4958951e298118de7b5d70b0e97d73da40c3eb29c19d9f55253da8fa89ebd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page