Twitter bots are written in Python and use Excel file as a source for tweets/search keywords. I wrote them because I'm too lazy to regularly post to Twitter and follow people. Bots try to avoid Twitter limits and in most cases they succeed. The project is very fresh, made with 'a duct tape and a chewing gum', so use it at your own risk and most certainly, do not use it as a good programming practice. See 3 bots in action:
- Upper left - an unfollower bot (unfollows people with tweets&followers<threshold,
- bottom left - a follower bot,
- bottom right- a bot that posts tweets:
xls2tw.py: endless posting of tweets from Excel spreadsheet to Twitter
follower_people.py: auto following people (twitter search people) based on keywords defined in Excel
follower_tw_slow.py: auto following people (twitter search tweets) based on keywords defined in Excel, 288 per day, avoiding Twitter limits
unfollower.py: unfollow people with too little tweets or followers
Requires: Python 3.9! (works also with 3.x, but the logging library requires 3.9)
Ubuntu, Mint and similar:
sudo apt install python3.9
You will also need pip3.9. Check https://stackoverflow.com/questions/65644782/how-to-install-pip-for-python-3-9-on-ubuntu-20-04
(or better, use venv)
Windows: just install Python 3.9 from the Windows Store.
-
Clone repo (or just download the files)
git clone https://github.com/trozman/Tweetbotty.git cd Tweetbotty
-
Install dependent packages
# Install Openpyxl - Excel library pip install openpyxl # Install Colorama - Coloured text output pip install colorama # Install Tweepy - Twitter library pip install tweepy
-
Create a project, development app and obtain Twitter keys (from your twitter development account) at https://developer.twitter.com/en/portal/dashboard
-
Upgrade your Twitter developer account to the 'Elevated' account (free)
-
Copy/paste your twitter keys in 'tweetconfig.txt'
-
Put some tweets to 'Tweets.xlsx', worksheet 'Tweets', Column B, each tweet to separate row
-
Optional: Put some images to /tw_pics subfolder, add references to image names (e. g. Image01.jpg) to Tweets.xslx Column F
-
Run it:
python xls2tw.py
-
This tweetbot will run forewer: it will read tweets and images (if exist) in sequence from excel tile, publish it to Twitter, pausing for X hours. If it finds the empty row in the spreadsheet(no more tweets), it will start from the beginning. You can add rows with tweets while this script is running. If you interrupt it (ctrl-c) and re-run it, it will start from the last published tweet.
The same as previous. Changes:
Step 6: Put comma separated keywords for people search in 'Tweets.xlsx', worksheet 'Keywords', cell A:2
Step 7: Run it:
python follower_people.py
The same as previous. Changes:
Step 6: Put comma separated keywords for people search in 'Tweets.xlsx', worksheet 'Keywords', cell B:2
Step 7: Run it:
python follower_tw_slow.py
Installation: unfollower.py (Un-Follower bot, get rid of people with too little followers or tweets)
The same as previous. Changes:
Step 6: Define filters, modify variables filter_followers and filter_tweets
Step 7: Run it: You can specify a filter which account to unfollow: -t and -f
python unfollower.py -t 500 -f 150