The expanded_url returned from the Twitter API is completely unreliable, so deploy it on your own.
It's very easy to do, just use urllib2.
expand_url.py
import urllib2
short_url = 'http://t.co/MmQomeme8u'
expand_url = urllib2.urlopen(short_url).geturl()
print expand_url
# python expand_url.py
http://www.huffingtonpost.jp/tabirai-okinawa/-_285_b_6483010.html?ncid=tweetlnkjphpmg00000001
However, this method is not all-purpose. It seems that it does not support redirect using JavaScript.
urllib2 geturl() does not work for some url redirects http://stackoverflow.com/questions/14319771/urllib2-geturl-does-not-work-for-some-url-redirects
Recommended Posts