Time Saver! Wine Tweets Follow Script

March 22nd, 20094:56 pm @ Josh Hermsmeyer


Lately I’d fallen woefully behind on re-following Twitter folks. In fact I was so far behind that I was about to declare Twitter bankruptcy. Then I chanced upon a solution: ruby gems that allow you to access Google Spreadsheets and access the Twitter API.

Now my Twitter life is in balance.

inBalance.png

If that all sounds greek to you, no need to worry. Here’s the gist. Using the script below you can follow all the wine tweets from dhonig’s list. That’s over 1000 wine tweets!

The script works well, but you will get some errors. Here are the various reasons why things won’t work out perfectly for you:

  • You won’t be able to follow folks who have set their status to private.
  • Some pages give a 403 error. Not sure why exactly. The pages are indeed there. Bummer.
  • Twitter limits the number of people you can follow to 2000, except in either extraordinary circumstances or when the Fail Whale himself deems you appropriately elite. So if you’re close to the magic number this may not work for you.
  • This is pretty geeky. If your eyes gloss over, I won’t feel bad at all if you silently click away. My apologies in advance!

I was a little worried that Spammers and their kissing cousins, The Crass Social Media Marketers, might use this script to inject a fetid cloud of spammy flatulence into our quaint little wine community, but I think the tech requirements to implement this argue for a level of intelligence that weeds out most marketers. And the pro spammers really don’t need any help from me to do their inglorious voodoo.

So, without further ado, let’s get started.

1. First you’ll need Ruby, a scripting language which comes pre-installed on a Mac. You’ll have to download and install it if you’re running Windows.

2. Next you need to install Ruby Gems. Gems are packages that add cool tools to Ruby that make it easy to do interesting things like talk to Twitter. You can download it here: http://rubyforge.org/frs/?group_id=126

Once that’s downloaded, just open terminal or its equivalent on Windows and type in:

sudo ruby setup.rb

and enter your password.

3. After that you’ll be able to install the rest of the required components right from the command line.

Type in/copy and paste:

sudo gem install twitter

and then type in/copy and paste:

gem sources -a http://gems.github.com
sudo gem install gimite-google-spreadsheet-ruby

4. Next download the Wine Tweeps ruby script here.

5. Open it and find these following lines of code and change the WORDS IN UPPERCASE to reflect your personal information. You’ll need a twitter account and a google docs/gmail account for this to work.

googleUser = “YOUR GOOGLE EMAIL LOGIN HERE
googlePassword = “YOUR GOOGLE PASSWORD HERE
twitterUserName = “YOUR TWITTER USER NAME HERE
twitterPassword = “YOUR TWITTER PASSWORD HERE

6. Save the file (make sure it still has a .rb extension and not a .txt one) and type the following line into the terminal:

ruby wineTweetsPublic.rb

It should start running and showing success and failure results within a minute or so. If you get login errors, it means that either your Google user name and password or you Twitter user name and password are incorrect.

If you have any other trouble, please leave a comment and I’ll do my best to help you out!

Also, I stole the idea and the implementation details for this script from David Clements.