Skip to content

Instantly share code, notes, and snippets.

@oieioi
Forked from no6v/trace.rb
Last active November 18, 2017 10:33
Show Gist options
  • Save oieioi/c474f307861279aeeacb to your computer and use it in GitHub Desktop.
Save oieioi/c474f307861279aeeacb to your computer and use it in GitHub Desktop.
Trace back home or user timeline
# encoding: UTF-8
Earthquake.once do
module TwitterOAuth
class Client
def favorites_list(user, **options)
options = URI.encode_www_form(options)
get("/favorites/list.json?screen_name=#{user}&#{options}")
end
end
end
end
Earthquake.init do
tracer = ->(timeline_method, *args, **options) do
loop do
tweets = twitter.__send__(timeline_method, *args, options)
#p tweets
break if tweets.empty?
options.update(max_id: tweets.last["id"].pred)
puts_items tweets.reverse
break unless confirm("continue?", :y)
end
end
command :favorites_trace do |m|
q = m[1]
tracer[:favorites_list, q]
end
help :favorites_tarce, "trace back users favs", <<-HELP
HELP
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment