Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
a Ruby script that grabs a given user's TweetReel media.
require 'rubygems'
require 'open-uri'
require 'json'
require 'net/http'
#what user?
username = 'kylesmyth'
#form url and get JSON
url = 'http://search.twitter.com/search.json?q='+ username +'+tweetreel.com'
buffer = open(url, "UserAgent" => "Ruby-Wget").read
result = JSON.parse(buffer)
#connect to tweetreel API
server = 'tweetreel.s3.amazonaws.com'
h = Net::HTTP.new(server, 80)
mentions = result['results']
mentions.each do |tweet|
#get HTTP Header Response, parse it's content type
response = h.request_head('/images/'+ tweet['id'].to_s() + '.jpg')
if (response['content-type'] == 'image/jpeg')
p 'http://' + server + '/images/' + tweet['id'].to_s() + '.jpg'
end
response = h.request_head('/video/'+ tweet['id'].to_s() + '.mov')
if(response['content-type'] == 'text/plain')
p 'http://' + server + '/video/'+ tweet['id'].to_s() + '.mov'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.