+ if unobfuscate_urls:
+ import urllib
+ rv = urlparse.urlparse(toReplace)
+ if rv.hostname in {
+ # sourced from http://bit.do/list-of-url-shorteners.php
+ "bit.do", "t.co", "lnkd.in", "db.tt", "qr.ae", "adf.ly",
+ "goo.gl", "bitly.com", "cur.lv", "tinyurl.com", "ow.ly",
+ "bit.ly", "adcrun.ch", "ity.im", "q.gs", "viralurl.com",
+ "is.gd", "po.st", "vur.me", "bc.vc", "twitthis.com", "u.to",
+ "j.mp", "buzurl.com", "cutt.us", "u.bb", "yourls.org",
+ "crisco.com", "x.co", "prettylinkpro.com", "viralurl.biz",
+ "adcraft.co", "virl.ws", "scrnch.me", "filoops.info", "vurl.bz",
+ "vzturl.com", "lemde.fr", "qr.net", "1url.com", "tweez.me",
+ "7vd.cn", "v.gd", "dft.ba", "aka.gr", "tr.im",
+ # added by ASB:
+ "trib.al", "dlvr.it"
+ }:
+ #expand list as needed.
+ response = urllib.urlopen('http://urlex.org/txt/' + toReplace)
+ resptext = response.read()
+ if resptext.startswith('http'): # ie it looks urlish (http or https)
+ if resptext != toReplace:
+ toReplace = resptext
+ # maybe make a note of the domain of the original URL to compile list of shortenable domains?
+