jnunemaker/twitter — pull request #205 by seanmoon (2011-10-20 16:02:10+00:00)
Title: Twitter::Status#all_urls method

Hey there,

So it looks like depending on how old your tweet is (especially before the Oct 11 2011 t.co switch) you'll see very different entities and URLS and such in Twitter's API response.

Here's a tweet's URL entities (id 126406520777867266) and text from a few days ago:

"urls": [
{
"url": "http://t.co/y0miz6cf",
"display_url": "instagr.am/p/Qnszj/",
"expanded_url": "http://instagr.am/p/Qnszj/"
}
],
"text": "The Internet http://t.co/y0miz6cf"

Whereas here is a tweet from July 25 2009 (id 2843006385):

"urls": [
{
"url": "http://twitpic.com/bm7ob",
"expanded_url": null
}
],
"text": "Computer time! http://twitpic.com/bm7ob"

What would help me (and perhaps others?) work with these sort of inconsistent responses is a method that returns all the URLs that are associated with the tweet so that one can work with a consistent interface regardless of the age of the tweet.

Thanks!

Sean