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.0rc3.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.0rc3-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: feedforbot-4.0.0rc3.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.0rc3.tar.gz
Algorithm Hash digest
SHA256 73f0a83e5174da4a43ce3d9108a5193a2653df3f1ad4dc946440f1f23f445176
MD5 6a23ac02ebc1e1ca9f98c4d8b7ca448c
BLAKE2b-256 1dc74426c9f265b6fac2a123288afdb3b78e9284f9cf320d47a3475587f015f1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: feedforbot-4.0.0rc3-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.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 25ade2c61e104ab5f66e0b46cd94f76d4b72daea2d08188bcc878b45eb0480dc
MD5 45515669cf0e1330e93e4d8351eddd9e
BLAKE2b-256 fe729ae54db625c2e99c9cc8361fc435064cd545a4086d4688ca24005886b559

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