Search code examples
apitumblrurl-shortener

Expand Tumblr shortened link


I have a Tumblr link like this: http://tumblr.com/XXXXXXXX

In order to communicate with their API I need the hostname of the blog, therefore I need to expand the link to the complete link. Something like: http://blogname.tumblr.com/post/XXXXXX

How can I expand a tumblr shortened link?


Solution

  • Within the Tumblr API, I do not believe it is possible as mentioned by Derek Gottfrid. If you are using it within your app or service you can try looking at the headers.

    For example in python, you can use urllib2

    import urllib2
    tumb = urllib2.urlopen('http://tumblr.com/XXXXXXXX')
    print tumb.url
    

    In PHP, you can use the get_headers method

    $url = 'http://tumblr.com/XXXXXXXX'
    print_r(get_headers($url))