Skip to content

Instantly share code, notes, and snippets.

@siyo
Created November 7, 2011 03:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save siyo/1344142 to your computer and use it in GitHub Desktop.
Save siyo/1344142 to your computer and use it in GitHub Desktop.
favstar 見るやつ / earthquakge.gem plugin
# -*- coding: utf-8 -*-
# favstar / earthquakge.gem plugin
#
# e.g. :favstar #=> your favstar
# :favstar who #=> who's favstar
#
require 'rss'
Earthquake.init do
command %r|^:favstar\s*(.+)*|, :as => :favstar do |m|
user = m[1] || twitter.info["screen_name"]
url = "http://favstar.fm/users/#{user}/rss"
feed = RSS::Parser.parse(open(url){|f| f.read}, false)
feed.items.reverse.each{|item|
star,text = item.title.scan(/^(\d+)\s+stars?:(.+)$/).flatten
puts "%s: %s %s" % [star.c(:notice), text, item.link.c(:info)]
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment