This project is used to automatically take news from the faculty's website and send them to Telegram's chat room #mmcsfamily.
The algorithm is simple:
- grab rss feed from the mmcs site
- skip news that were previously sent
- write messages with a special instant view link
- send them to the chat #mmcsfamily
This sequence is reflected in the src/app.js
file:
grabRSS(FEED_URL)
.then(extractPosts)
.then(skipExisting)
.then(ps => console.log(`New posts: ${ps.length}`) || ps)
.then(sendToChat)
.then(savePosts)
There is the .env.example
file in the project root. Rename it to .env
, change variables inside, then download all dependencies by npm i
, and run the app with npm start
command.
To add a task to cron run crontab -e
, then add the line:
*/30 * * * * cd /root/mmcs-news-scraper/ && /root/.nvm/versions/node/v13.11.0/bin/node -r ./register.js ./src/index.js