Skip to main content

Forward links from RSS/Atom feeds to messengers

Project description

FeedForBot

PyPI PyPI Docker Pulls PyPI

Forward links from RSS/Atom feeds to messengers

Installation

pip install feedforbot -U

Usage

From code

import asyncio

from feedforbot import Scheduler, TelegramBotTransport, RSSListener


def main():
  loop = asyncio.new_event_loop()
  asyncio.set_event_loop(loop)
  scheduler = Scheduler(
    '* * * * *',
    listener=RSSListener('https://www.debian.org/News/news'),
    transport=TelegramBotTransport(
      token='123456789:AAAAAAAAAA-BBBB-CCCCCCCCCCCC-DDDDDD',
      to='@channel',
    )
  )
  scheduler.run()
  loop.run_forever()

if __name__ == '__main__':
  main()

CLI

Save to file config.yml data

---
cache:
  type: 'files'
schedulers:
  - 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: 'https://habr.com/ru/rss/news/?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 %}
  - 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 }}

Start script

feedforbot --verbose config.yml

Docker

Docker Hub

docker run shpaker/feedforbot --help

GHCR

docker run ghcr.io/shpaker/feedforbot --help

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-3.3.4.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

feedforbot-3.3.4-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file feedforbot-3.3.4.tar.gz.

File metadata

  • Download URL: feedforbot-3.3.4.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for feedforbot-3.3.4.tar.gz
Algorithm Hash digest
SHA256 e09bd8d674ecfaf7f7d4c0808fcfe27d2a1da1978167f75547b51130b42c2392
MD5 15eabdf0f6920f33c9f13df56fa5150d
BLAKE2b-256 881662cbc8e907ba943b4d764babff8552d4b4b783c8a47fbfdd722f3f84b5ae

See more details on using hashes here.

File details

Details for the file feedforbot-3.3.4-py3-none-any.whl.

File metadata

  • Download URL: feedforbot-3.3.4-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for feedforbot-3.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0035f56b5274371ac5e24ab25c98d8d9e03932c760d3d93f36777f9273fd6d02
MD5 b16c4eaa698aa24dc034bb5e876afc71
BLAKE2b-256 8872926a83533705c170f6e688f5d8df6b1ae0dc486b036fa4734bd609c27a7d

See more details on using hashes here.

Supported by

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