Request webpages, scrape for and use data to create tweets
scrape_web.py
scrapes predetermined webpages for the bird facts that are shown on each. If the fact is less than or equal to 140 characters, it is written to a text file. This script is only ran once prior to the first automated running of bot.py
so as to create and fill the text file
bot.py
pulls what to tweet from a text file and then deletes that line from the file. The script then authenticates connection to the Twitter account and attempts to send out the tweet. Whatever occurs is written to a log file
follow_back.py
makes sure that the account is following all of its followers. Whatever occurs is written to the same log file written to in bot.py
46 facts written to ./facts.txt for tweeting
0 12 * * * python ./bot.py`<br>`0 0,6,12,18 * * * python ./follow_back.py
-
I use Crontab for scheduling daily automation
-
Basic framework for
bot.py
was forked from molly/twitterbot_framework for creating Twitter bots using Tweepy. This goes along with her tutorial on creating Twitter bots
-
If
bot.py
fails to send a tweet, do not delete that fact from the text file -
Remove repetitiveness from
scrape_web.py
-
Add error handling to
bot.py
and use a second log to record occurences
This was originally created so that my old team would have a supply of random bird facts to cheer