This repository contains three Python scripts: monitor_rss.py
, get_user_id.py
, and push_dingding.py
.
monitor_rss.py
is a script that monitors specified RSS feeds for new entries and sends updates to a specified Telegram user through a bot.
get_user_id.py
is a script that helps you retrieve the user ID of a Telegram user, which is necessary for monitor_rss.py
to send updates to the correct person.
push_dingding.py
is a script that can send messages to DingTalk (also known as DINGDING) by using DingTalk's outgoing webhooks feature.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Make sure you have installed the following Python packages:
telebot
feedparser
beautifulsoup4
If not, you can install them using pip:
pip install pyTelegramBotAPI feedparser beautifulsoup4
Clone this repository to your local machine:
git clone https://github.com/yourusername/rss-feed-monitor.git
Before running monitor_rss.py
, you need to get the user ID of the Telegram user to whom the bot should send updates.
- Replace
bot_token
inget_user_id.py
with your Telegram bot token.
bot_token = 'your-telegram-bot-token'
- Run
get_user_id.py
. It will print the user ID and the message text of every message your bot has received.
python get_user_id.py
- Replace
bot_token
anduser_id
inmonitor_rss.py
with your Telegram bot token and the user ID you got fromget_user_id.py
, respectively.
bot_token = 'your-telegram-bot-token'
user_id = 'your-user-id'
- Replace
rss_urls
with the list of RSS feeds you want to monitor.
rss_urls = ['rss-feed-1', 'rss-feed-2', '...']
-
If you want to send messages to DingTalk as well, import the
send_to_dd
function frompush_dingding.py
and call it in thesend_message
function. -
Run
monitor_rss.py
. It will check the RSS feeds every 5 minutes and send a Telegram message (and a DingTalk message if configured) for each new entry.
python monitor_rss.py
- Replace
secret
andaccess_token
with your DingTalk webhook's secret and access token.
secret = "your-secret"
access_token = "your-access-token"
- Call
send_to_dd(msg)
function, wheremsg
is the message you want to send.
send_to_dd("Hello, DingTalk!")