Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

MasterGroosha/telegram-rss-generation

Repository files navigation

Create RSS/Atom feed for Telegram channel

⚠️ Warning! This code was made a long time ago, lots of API changes happened since then, making some parts of this code useless. For example, bots can already read messages in channels.

Update 16 May 2019: It seems that Telegram now allows to read public channels in browser (https://t.me/tgbeta/3618) even without Telegram account. So this repo now goes read-only and just for historical purposes. So long and thanks for all the fish!

This code allows you to form an RSS feed when you post messages to channel via bot. It works fine for me, but there can be some bugs.
In theory, devs can use this to form RSS/Atom feed for their channels to make content available outside Telegram.

Prerequisites

Installation

To install feedgen you need 1024+ megabytes of RAM, also you need to install some libs first:

sudo apt-get install sqlite3 libxml2 libxml2-dev libxslt1.1 libxslt1.1-dev  
pip3 install feedgen pytz pytelegrambotapi cherrypy  
sqlite3 storage.db < create_db.sql
  1. Rename config_example.py to config.py (Important)
  2. Fill in the necessary fields in config.py file
  3. Launch bot using webhooks with self-signed certificate (sample_custom_post.py) or check sample auto-posting bot (sample_hourly.py)

Check that your bot is set as admin in your channel!
If using custom poster, open chat with your bot and write a message to it. You should see that message in both channel and RSS/Atom feed.

Notes and restrictions

  • It's still unknown, why some RSS Parsers take too long to find updates in feed (though QuiteRSS for Windows finds updates instantly)
  • In this version of code, you can only remove one entry from feed at a time. No way to also remove message from channel, only manually with /remlast command (Restriction of Bot API).
  • Only text messages are supported.
  • parse_mode argument is set to "HTML" by default (to be compatible with real RSS readers). You can disable it in code or change to "Markdown".

Any questions?

The code provided here should be self-explanatory, but in case you get stuck somewhere, feel free to e-mail me: groosha @ protonmail.com (remove extra spaces)

About

A concept that allows to generate an RSS/Atom feed for your Telegram channel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages