Created
December 12, 2008 20:02
-
-
Save macournoyer/35253 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
# List tweets w/ links. | |
# require: sudo gem install jnunemaker-twitter --source http://gems.github.com | |
# usage: twitlinks [num] | |
require "rubygems" | |
require "twitter" | |
# EDIT THIS | |
EMAIL = 'ur@emailz.com' | |
PASSWORD = 'greenerpoop' | |
trap("INT") { puts; exit } | |
def link(text) | |
text[/http:\/\/.*?(\s|$)/, 0] | |
end | |
tweets = Twitter::Base.new(EMAIL, PASSWORD).timeline.select { |t| link(t.text) } | |
tweets.each_with_index do |t, i| | |
puts "[%i] %s: %s" % [i, t.user.name, t.text] | |
end | |
unless visit = ARGV.first | |
print "open? " | |
visit = STDIN.readline | |
end | |
exec "open #{link tweets[visit.to_i].text}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment