Reads RSS feeds and post links to Twitter, also search for keywords and #hashtag to retweet
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.


Twitterbot is a simple Python application for:

  • reading and parsing a RSS feed and posting its title and links to a Twitter account.
  • searching tweets for keywords or hashtags and retweet those tweets.

Both functions (Reading RSS and retweeting) can be used independently. The bot is limited to handle one feed and one Twitter account.


  1. Download or git clone Twitterbot:
    • git clone
  2. Install dependencies feedparser and twython:
    • pip install feedparser
    • pip install twython
  3. Create a Twitter application, and generate keys, tokens etc.
  4. Modifiy the settings in the source code.
    • Modify FeedUrl to the RSS feed you want to read.
    • Modify the variables in the TwitterAuth class and add keys, tokens etc. for connecting to your Twitter app.
    • Modify RetweetIncludeWords for keywords you want to search and retweet, and RetweetExcludeWords for keywords you would like to exclude from retweeting. For example RetweetIncludeWords = ["foo"] and RetweetExcludeWords = ["bar"] will include any tweet with the word "foo", as long as the word "bar" is absent. This list can also be left empty, i.e. RetweetExcludeWords = [].


Read the RSS feed and post to Twitter account:

$ python rss

Search for tweets and retweet them:

$ python rt

Setup crontabs examples

Preferably, you should use crontab to set up Twitterbot to run on a schedule.

crontab examples:

# Read RSS feed every hour and tweet new links.
00 * * * * python rss

# Rewteet keywords/hashtags every 15 minutes.
*/15 * * * * python rt

Use the cron schedule expression editor to easily create crons.


How do I retweet a specific user?

Use the Twitter search operators.

For example, search for user account @soccerfan:

RetweetIncludeWords = ["from:soccerfan"]

Search for hashtag #football from user account @soccerfan:

RetweetIncludeWords = ["#football+from:soccerfan"]

How do I post the description instead of the title?

Modify the ReadRssAndTweet() method and use item["description"] for title instead, like so:

# Read RSS and post tweet.
def ReadRssAndTweet(url):
	feed = feedparser.parse(url)
	for item in feed["items"]:
		title = item["description"]   # <--------------- Modify this line.
		link = item["link"]
		# Make sure we don't post any dubplicates.
		if not (IsUrlAlreadyPosted(link)):
			PostTweet(title, link)
			print("Posted: " + link)
			print("Already posted: " + link)