Skip to content

Instantly share code, notes, and snippets.

@ivey
Created May 7, 2009 02:48
Show Gist options
  • Save ivey/107892 to your computer and use it in GitHub Desktop.
Save ivey/107892 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'sqlite3'
db = SQLite3::Database.new( "favorites.db" )
main = Twitter::Base.new(Twitter::HTTPAuth.new('ivey', 'PW'))
favs = Twitter::Base.new(Twitter::HTTPAuth.new('iveyfavs', 'PW'))
count = 0
main.favorites.reverse.each do |i|
unless db.get_first_row("select * from favorites where guid = '#{i.id}'")
db.execute "insert into favorites values ('#{i.id}')"
next if i.user.protected && i.user.screen_name != "extraface"
status = "RT @#{i.user.screen_name} #{i.text}"
if status.size > 140
status = status[0..136] + "..."
end
favs.update status
count += 1
sleep 5
end
exit if count >= 3
end
# httpauth = Twitter::HTTPAuth.new
# base = Twitter::Base.new(httpauth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment