Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


RTs via RE's

To use regextweet, simple create an account, register an app, and copy these the keys found on into a text file named api.txt in the project's root directory, i.e:


With regextweet we can quickly follow a list, filter information of interest, and retweet it. Here's the usage template:

python --u user_name --l list_name --o list_owner --r "regex" --a api.txt --h handles.txt


  • --u defines the user name of the retweetbot

  • --l defines the name of the list to follow and filter,

  • --r is the quoted regular expression to query the text with.

  • --o is the user name of the person who owns the list (optional; see below)

  • --a is the filepath to the textfile with your api credentials (default = "api.txt")

  • --h is the filepath to the textfile with the list of twitter users to follow (optional; regextweet will not bother with this if --o is provided, and will just follow the list --l owned by user --o. If neither--o nor --h are provided, --h defaults to "header.txt" . If this is the case and "header.txt" does not exist, the program will break')

So for YourRepsOnGuns, where we retweeted from the list named "members-of-congress" under CSPAN's account, we simply typed:

python --u yourrepsonguns --l members-of-congress --o cspan --r "(gun)"

However, this only ran the retweet bot once.

To run it on a continual basis, we created a cron job by writing:

crontab -e

And inserting this line of text at the top of our crontab settings.

*/5 * * * * /usr/bin/python /home/ec2-user/ python --u yourrepsonguns --l members-of-congress --o cspan --r "(gun)"

Here, the five *'s correspond to minutes, hours, days, months, years, respectively. Our setting runs the job every 5 minutes forever.

Make your own tweetbot

If you want to try out simply download the repository, navigate to the extracted folder and customize api.txt and handles.txt according to your preferences. Before running, make sure to run:

sudo pip install tweepy oauth2 requests

which should cover the necessary dependencies.

Now you can create an account called "biebergoestowashington" and retweet every time a representative mentions justin bieber by simply typing:

python --u biebergoestowashington --l members-of-congress --o cspan --r "(bieber)"


While only works for twitter feeds, the same idea could scale to facebook pages, rss feeds, and even CSPAN by using opened-captions. Help me build something better!