Platinum Partner

Resolve Tinyurl To Destination URL

from lxml import etree

def reverse_tinyurl(url):
    hash = url[url.find(".com/")+5:]
    preview_url = "http://preview.tinyurl.com/"+hash
    parser = etree.HTMLParser()
    tree = etree.parse(preview_url, parser)
    elem = tree.findall('.//a[@id="redirecturl"]')
    if len(elem) == 1:
        return elem[0].get("href")
    return None
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}