Created
April 1, 2012 08:00
-
-
Save SathyaBhat/2273068 to your computer and use it in GitHub Desktop.
Ruby code to go through home timeline & expand t.co URLs
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
require 'twitter' | |
def setup_twitter() | |
Twitter.configure do |config| | |
config.consumer_key = "" | |
config.consumer_secret = "" | |
config.oauth_token = "" | |
config.oauth_token_secret = "" | |
end | |
twitter = Twitter::Client.new | |
end | |
twitter = setup_twitter() | |
tweets = twitter.home_timeline | |
tweets.each do |ht| | |
t = twitter.status(ht.id, :include_entities => true) | |
expanded_link = t.urls[0].expanded_url unless t.urls.empty? | |
link = t.urls[0].url unless t.urls.empty? | |
links = "URL: #{link} expands to #{expanded_link}" unless link.nil? | |
puts "Status: #{ht.text} #{links}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yo @iambibhas. Pls to excuse. Testing something,