Skip to content

Instantly share code, notes, and snippets.

@yhara
Created August 23, 2012 12:21
Show Gist options
  • Save yhara/3436168 to your computer and use it in GitHub Desktop.
Save yhara/3436168 to your computer and use it in GitHub Desktop.
load "login.rb"
def cleanup!(hash)
hash.keys.each do |key|
hash.delete(key) if [nil, false, 0].include?(hash[key])
end
end
(1..Float::INFINITY).lazy
.flat_map{|page|
sleep 1
p page:page
Twitter.user_timeline(count: 200, page: page, trim_user: true)
}.select{|tweet|
tweet.created_at < Time.new(2012, 5, 15)
}.take_while{|tweet|
tweet.created_at > Time.new(2012, 4, 15)
}.each{|tweet|
attrs = tweet.attrs
cleanup!(attrs)
pp attrs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment