Skip to content

Instantly share code, notes, and snippets.

@milligramme
Last active December 27, 2015 15:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milligramme/7350045 to your computer and use it in GitHub Desktop.
Save milligramme/7350045 to your computer and use it in GitHub Desktop.
saved search をすべて表示する earthquake.gem plugin
# -*- coding: utf-8 -*-
# show all saved search results
module TwitterOAuth
class Client
def get_saved_search(user)
get("/saved_searches/list.json?screen_name=#{user}")
end
end
end
module Earthquake::Input
def results
@results ||= []
end
def puts_results
@results.each do |result|
puts " q => \"#{result['name']}\" ".c([42,37])
search_options ||= {}
r = twitter.search(result['name'], search_options)['statuses']
puts "No Tweet results for #{result['query']}".c(91) if r.empty?
r.reverse.each do |x|
puts_items x
end
end
end
end
Earthquake.init do
@results = twitter.get_saved_search(twitter.info["screen_name"])
command :saved_search do
puts_results
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment