Who’s On First on Twitter

I’ll start this by saying I know this is a dumb idea.

I was looking up fictitious characters on Twitter and found Mia from Californication.  That and the Sterling Cooper [Mad Men] Crew. Anyway, I suggested to my buddy Ari that we should create fake twitters for West Wing Characters (LemonLyman!)  But alas, too much conversation and too little movement through hallways.  I also toyed with idea of re-creating I Have a Pony in realtime.

But twitter rate limiting (100 per hour) is a bitch.  Then it came to me. Who’s On First

Feel free to follow @bud_abbott and @lou_costello on Twitter. I didn’t do too much error checking, so if the Twitter API wigs out, the conversation will stop. If I get enough (read: any) followers I’ll start a nightly performance.

Here’s the source text: back_and_forth.txt

And the code:

require('rubygems')
gem('twitter4r', '0.3.0')
require 'twitter'
require 'time'

client_abbott = Twitter::Client.new(:login => 'bud_abbott', :password => 'XXXXXXXX')
client_costello = Twitter::Client.new(:login => 'lou_costello', :password => 'XXXXXXXX')

puts "Logged In, Now Lets Go Through The Script"

File.new('back_and_forth.txt').readlines.each { | response |
  who_said_it, line = response.split(": ")
  if who_said_it.to_s == "Abbott"
    puts "Abbott: #{line}"
    begin
      status = client_abbott.status(:post, line)
      rescue RESTError => re
        puts re.code, re.message, re.uri
    end
  elsif who_said_it.to_s == "Costello"
    puts "Costello: #{line}"
    begin
      status = client_costello.status(:post, line)
      rescue RESTError => re
        puts re.code, re.message, re.uri
    end
  end
}

puts "Finished!"

Related posts:

  1. Updating Twitter from Google Talk Status
  2. Last Facebook Ruby Code – Grids
  3. Google Talk
  4. It’s all been done before, yet here’s my soution to the Mike Korn facebook puzzle
posted on Monday, December 8th, 2008 by kremdela in Professional

0 Comments

Leave Comment