Skip to content

Instantly share code, notes, and snippets.

@jellybob
Created October 26, 2011 13:58
Show Gist options
  • Save jellybob/1316433 to your computer and use it in GitHub Desktop.
Save jellybob/1316433 to your computer and use it in GitHub Desktop.
Win "be the nth follower" contests
require 'capybara'
require 'capybara/dsl'
require 'capybara/webkit'
include Capybara::DSL
account = ARGV[0]
count = ARGV[1]
Capybara.current_driver = :webkit
Capybara.app_host = 'http://mobile.twitter.com'
visit "/#{account}"
followers = page.find(%Q{a[href="http://mobile.twitter.com/#{account.downcase}/followers"]}).text.split(':').last.to_i
while true
if followers == count - 1
%x{say 'Follow #{account} now to win.'}
else
puts "Checked, #{followers} followers. Sleeping for 15 seconds."
sleep 15
end
end
gem install capybara capybara-webkit
ruby follower_count.rb AccountWithFreeStuff 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment