I want to expand t.co short links into a full URL. How can I do that?
The easiest way in python2 is to use urllib2.urlopen()
:
tco_url = "http://t.co/whatever"
req = urllib2.urlopen(tco_url)
print req.url
will print the URL tco_url
finally resolves to, after following all redirects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With