Return to Snippet

Revision: 7582
at July 30, 2008 13:41 by huacnlee

Initial Code
def tiny_url(url):
    apiurl = ""
    tinyurl = urllib.urlopen(apiurl + url).read()
    return tinyurl

def content_tiny_url(content):
    regex_url = r'http:\/\/([\w.]+\/?)\S*'
    for match in re.finditer(regex_url, content):
        url =
        content = content.replace(url,tiny_url(url))
    return content

Initial URL

Initial Description
Python make url address to Tinyurl in article content like Twitter message

Initial Title
Python make url address to Tinyurl

Initial Tags
python, twitter

Initial Language