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

Uploaded Python 3

File details

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

File metadata

  • Download URL: feedforbot-4.0.0rc2.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.0rc2.tar.gz
Algorithm Hash digest
SHA256 334f9fe4da96b9820fb1e862bc849a98c0f76edabe9b6a548cea7f99165055f5
MD5 d54a1839df78526e3ed618348543bd51
BLAKE2b-256 ed923b3a5b02763ca4a0b749c5ba4890d6cf6f24b6b458ec4d3bdfbf0bb5ade0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: feedforbot-4.0.0rc2-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.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 bd8656b31efa41207c4d1f0503388a3b0f7435fed2fba0417a2b146c906e23b6
MD5 f7f473a9ba1c80e2577410fe6b141588
BLAKE2b-256 dee3d276cb9c1c9a44f2699ac5a01ee1c3371fa087c4241f1dfbafb37a23505a

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