A simple retweet bot with Yahoo Pipes and Tweethopper


Image by Marius!! via Flickr

This is not an invasive bot, but a little “pipe” bot. And you don’t have to be able to program, just be able to think logically (somewhat). I am making this one for OpPinkPower. She wants to make sure she doesn’t miss #OpIon and #ENOUGH tweets while sitting confused in an obscene amount of information.

The images link to larger, readable images of itself.

Accounts needed

  • Sign in to your Twitter account
  • Sign up and in to Yahoo Pipes
  • Sign up and in to Tweethopper and add your Twitter account.
  • Sign up and in to Bit.ly. In Account Settings you can find your bit.ly API key. You might as well authorise bit.ly for your twitter account.

Tweethoppers free plan allows for only one job, so we better make that a job worthwhile.

Create Twitter Search Feeds

Don’t make more than three Twitter search feeds that are not too wide, or else you will be drawing too much data too often from Twitter and your account may get suspended, even when you are not doing it to get more followers (Twitter Rules)

Make your Twitter Searches as narrow and focused as possible. You can use the Advanced Search or Twitter search operators for that.

Then right-click on the little “Feed for this query” button up top on the right, and from the menu choose the function that copies the link. OpPinkPower will retweet these:

Make Yahoo Feed

Go to your tab with Yahoo Pipes. Click on Create a Pipe.

In the new window on the left are a number of grouped elements/functions/objects that we’ll use. Under Sources get a Fetch Feed, and add the Twitter Search Feeds you made.

Under Operators get a Filter and create a link from Fetch Feed to the Filter

Set the Filter to “Permit items that match all of the following”, and using the dropdown box, choose “item.content.content to Contain http://

Add another filter and link the previous to this one. Set this Filter to “Block items that match any of the following”, and set:

  • item.author.uri to Contain YourTwitterName (you do not want to retweet your own)
  • item.title to Contain RT.*RT (exclude retweets of retweets)
  • item.title to Contain @ (exclude direct messages)
  • item.twitter:lang to Does not contain en (we’ll only retweet english tweets in this example)

From Operators get a Loop, and from the String group get a String Builder and place it in the Loop.

Add the strings item.author.uri, item.y:published.year, and item.content.content, and assign results to item.title.

The String builder only uses predefs and has none for a space, so the middle one, item.y:published.year is part of a workaround to create a space where we want it later (see below).

Get a RegEx from Operators. Ye need two:

  • In item.title replace http://twitter.com/ with RT @. Do not forget the second slash in http://twitter.com/.
  • In item.title replace 2011 with a space. Not a dash, or \s, 040, or whatever code indicating a space, but a space. Just a space.

Now connect the RegEx to the Pipe Output. That’s it for the Yahoo Pipe Building. Click “save” (up top right) and enter a name for your pipe. Somewhat to the left is a “Back to My Pipes” link, open it in a new tab, click your pipe, and copy the link of the RSS Feed:

Copy the RSS link and use twitterfeed: Making sockpuppet music by retweeting twitter search terms

Add to Tweet Hopper isn’t working yet

Open up the Twitter account you added to Tweethopper and select Add Feed Tweet Job

A little blue link “Add Feed Url” appears on the same page just below the three options. Click it, enter the Yahoo Pipe RSS Feed you have just made, and your bit.ly username and API key, and “Update This Account” at the bottom. You’re done. The Feed-Tweet job runs every 10 mintues. I hope we soon get to have a feature where we can set this (with a minimum time of course).

It may take awhile for the retweets to start happening. And tweets currently still get broken off at a hashtag. I have posted a question in the tweethopper forum (section problems) for that as the Pipe delivers the hashtags just fine.

Existing Pipes are share-able and copy-able, and you can also ask me to make a new pipe for you. I may have time, I may not have time for that. 🙂 And post questions and problems below. I’ll respond. Suggestions for improvement of above guide and pipe is also very welcome. In fact, anything you say and write below will be used for that.

Posted on May 12, 2011, in Tools and tagged , , , , , , , , , . Bookmark the permalink. 4 Comments.

  1. Thanks, it works. Can i also set a function in Yahoo Pipes for more frequent update? Now he updated after +/- 45 minutes. Can i set that to (for example) 5, 10 or 15 minutes?

    • I have not found such a function, but I didn’t look either. Twitterfeed’s smallest update window is 30 minutes. Any faster wouldn’t make sense, unless you are using another service with faster update?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s