Created
October 5, 2011 09:42
-
-
Save ichi/1264048 to your computer and use it in GitHub Desktop.
earthquake plugin: open any url in 1tweet
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 -*- | |
Earthquake.init do | |
command %r{^:open\s+(\d+)\s+(\d+)$}, :as => :open do |m| | |
num = m[2].to_i | |
urls = URI.extract(twitter.status(m[1])['text']) | |
if !urls.empty? | |
if num <= urls.size | |
browse urls[num - 1] | |
else | |
puts "#{num} links not found (but found #{urls.size})".c(41) | |
end | |
else | |
puts "no link found".c(41) | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment