Time Saver! Wine Tweets Follow Script

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.

Wine Tweets

6 Comments → “Time Saver! Wine Tweets Follow Script”

  1. Dr. Horowitz 4 years ago  

    What directory do we install rubygems in? Error in step 2:

    “No such file or directory — setup.rb (LoadError)”

    But, I see the setup.rb file sitting on my desktop…

  2. Josh 4 years ago  

    Try going to the terminal and typing

    cd ~/Desktop

    and then

    sudo ruby setup.rb

    This assumes that setup.rb is still on your desktop…

    Let me know if this works.

  3. Dr. Horowitz 4 years ago  

    I opened rubygems-1.3.1 folder contents onto my desktop and made it to step 3

    Step 3 error message: “sudo: gem: command not found”

  4. Josh 4 years ago  

    That means that gems didn’t install correctly.

    Instead of empying everything on the desktop, try redownloading the file and then type this in finder:

    cd ~/Desktop/rubygems-1.3.1

    and then

    sudo ruby setup.rb

    You should get a confirmation message in your terminal window that gems installed correctly. If you don’t something went wrong. Feel free to post back here if that’s the case.

  5. Dr. Horowitz 4 years ago  

    Still no dice. Maybe it’s because of some weird SSU admin account restriction…

    Last login: Mon Mar 23 19:33:55 on console
    Welcome to Darwin!
    Tiger-Intel-10-4-11vH:~ david07$ cd ~/Desktop/rubygems-1.3.1
    Tiger-Intel-10-4-11vH:~/Desktop/rubygems-1.3.1 david07$ sudo ruby setup.rb
    Password:
    ./lib/rubygems.rb:723:in `set_paths’: uninitialized constant Gem::Etc (NameError)
    from ./lib/rubygems.rb:719:in `each’
    from ./lib/rubygems.rb:719:in `set_paths’
    from ./lib/rubygems.rb:526:in `path’
    from ./lib/rubygems/source_index.rb:66:in `installed_spec_directories’
    from ./lib/rubygems/source_index.rb:56:in `from_installed_gems’
    from ./lib/rubygems.rb:736:in `source_index’
    from ./lib/rubygems/gem_path_searcher.rb:86:in `init_gemspecs’
    from ./lib/rubygems/gem_path_searcher.rb:21:in `initialize’
    from ./lib/rubygems.rb:684:in `new’
    from ./lib/rubygems.rb:684:in `searcher’
    from ./lib/rubygems.rb:683:in `synchronize’
    from ./lib/rubygems.rb:683:in `searcher’
    from ./lib/rubygems/custom_require.rb:34:in `require’
    from /usr/lib/ruby/1.8/tmpdir.rb:12
    from ./lib/rubygems/custom_require.rb:31:in `gem_original_require’
    from ./lib/rubygems/custom_require.rb:31:in `require’
    from setup.rb:95
    Tiger-Intel-10-4-11vH:~/Desktop/rubygems-1.3.1 david07$ sudo ruby setup.rb
    ./lib/rubygems.rb:723:in `set_paths’: uninitialized constant Gem::Etc (NameError)
    from ./lib/rubygems.rb:719:in `each’
    from ./lib/rubygems.rb:719:in `set_paths’
    from ./lib/rubygems.rb:526:in `path’
    from ./lib/rubygems/source_index.rb:66:in `installed_spec_directories’
    from ./lib/rubygems/source_index.rb:56:in `from_installed_gems’
    from ./lib/rubygems.rb:736:in `source_index’
    from ./lib/rubygems/gem_path_searcher.rb:86:in `init_gemspecs’
    from ./lib/rubygems/gem_path_searcher.rb:21:in `initialize’
    from ./lib/rubygems.rb:684:in `new’
    from ./lib/rubygems.rb:684:in `searcher’
    from ./lib/rubygems.rb:683:in `synchronize’
    from ./lib/rubygems.rb:683:in `searcher’
    from ./lib/rubygems/custom_require.rb:34:in `require’
    from /usr/lib/ruby/1.8/tmpdir.rb:12
    from ./lib/rubygems/custom_require.rb:31:in `gem_original_require’
    from ./lib/rubygems/custom_require.rb:31:in `require’
    from setup.rb:95
    Tiger-Intel-10-4-11vH:~/Desktop/rubygems-1.3.1 david07$ sudo gem install twittersudo: gem: command not found

  6. Tim 4 years ago  

    Josh,

    I’m tracking with you and have all the stuff installed correctly. I just get this error when running the script:

    wineTweetsPublic.rb:15:in `initialize’: wrong number of arguments (2 for 1) (ArgumentError)
    from wineTweetsPublic.rb:15:in `new’
    from wineTweetsPublic.rb:15

    Doesn’t seem to matter if I have my Google username by itself or with @gmail.com so I think it’s something besides inputting my account details wrong. Have any idea what’s going on here?