Last active
December 27, 2015 15:48
-
-
Save milligramme/7350045 to your computer and use it in GitHub Desktop.
saved search をすべて表示する earthquake.gem plugin
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
# -*- 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