Small project for scraping RSS feed and repost new messages to Telegram group/channel.
git clone https://github.com/EvilFreelancer/rss-to-telegram-bot.git
cd rss-to-telegram-bot
.env
file from examplecp .env.dist .env
Fix .env
parameters, you at least need to add list of RSS feed sources and API token of Telegram-bot
Run the script
php -f rss-to-telegram.php
This project already has Dockerfile, so you may build your own docker image and use it.
version: "2.4"
services:
rss-to-telegram-bot:
restart: "unless-stopped"
build:
context: .
environment:
# Timeout in seconds between requests to rss feed
RSSREADER_TIMEOUT: 600
# Path to RSS feed cache folder
RSSREADER_CACHE_DIR: /app/cache
# Limiting the number of recent posts
RSSREADER_LIMIT: 50
# List of comma-separated URLs of RSS sources
RSSREADER_SOURCES: https://portal1/news/rss/,https://portal2/rss/
# If you want to show categories as hash-tags
RSSREADER_SHOW_CATEGORIES_AS_TAGS: false
# Telegram Channel Name
TELEGRAM_CHANNEL_NAME: evilfreelancer
# Telegram Access Token
TELEGRAM_TOKEN: nnnnnnnnnnnnn:xxxXXXxXxXxXxXXxXxxXxxxxXx
volumes:
- ./bot_cache:/app/cache:rw
logging:
driver: "json-file"
options:
max-size: "50k"
Name | Default value | Description |
---|---|---|
RSSREADER_TIMEOUT | 3600 (in seconds) | Timeout between requests for updates |
RSSREADER_CACHE_DIR | /tmp/.rssreader_cache | Path to directory with cache |
RSSREADER_LIMIT | 0 (0, empty or not set - unlimited) | Limiting the number of recent posts |
RSSREADER_SOURCES | null | List of comma-separated URLs of RSS sources |
RSSREADER_SHOW_CATEGORIES_AS_TAGS | false | If you want to show categories as hash-tags |
TELEGRAM_CHANNEL_NAME | null | Telegram Channel Name |
TELEGRAM_TOKEN | null | Telegram Access Token |