Ruby Web Scraper Telegram Bot.
First, you need to obtain a Telegram Bot token, by following this guide: Telegram Bot How-To.
After that, obtain your personal Telegram ID. Put both of these into their respective environment variables:
export RSCRAP_TOKEN=xxxxxxxx:ASDFffwf34444
export RSCRAP_USER_ID=111111111Than run bundle install in the ruby folder to install all the gems. Once that's finished, setup the db with bundle exec ruby init_db.rb.
Create a crontab if you don't have any:
crontab -eAnd add this line:
0 6-23 * * * /bin/bash -l -c 'cd /home/<user>/rubyproj/rscrap && bundle exec ruby scripts/reddit.rb'For reddit, I recommend a one hour refresh rate based on how many subreddits you are following. You don't want to spam yourself too much. And the bot does handle bulk updates.
RScrap now supports URL shortening using bit.ly. Just set up these two environment properties:
export RSCRAP_BITLY_USERNAME=username
export RSCRAP_BITLY_API_KEY=api_keyThis is how it looks like with shortened URLS:
After the scrip runs you should see something like this from your bot:
Contributions, issues, and PRs are very welcomed.


