Skip to content

Instantly share code, notes, and snippets.

@benstein
Created April 16, 2009 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benstein/96716 to your computer and use it in GitHub Desktop.
Save benstein/96716 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/ruby
require 'rubygems'
require 'twitter'
require 'open-uri'
require 'hpricot'
TARGET_USER = "aplusk"
TARGET_COUNT = 1_000_000
URL = "http://twitter.com/#{TARGET_USER}"
ID = '#follower_count'
USERNAME = ''
PASS = ''
twitter = Twitter::Base.new(USERNAME,PASS)
count = 0
response = ''
while count < TARGET_COUNT
open(URL){|f| response = f.read}
count = Hpricot(response).search(ID).inner_html.gsub(',','').to_i
p "#{Time.now}: #{TARGET_USER} has #{count} followers"
if (count == TARGET_COUNT-1)
p "Holy crap! Follow him! Quick!"
twitter.create_friendship TARGET_USER
twitter.follow TARGET_USER
end
sleep(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment