Created
August 23, 2012 12:21
-
-
Save yhara/3436168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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