From 7e9837dd37d6584aa52b5a0d2d2a6ed17c2af629 Mon Sep 17 00:00:00 2001 From: Brad Cowie Date: Wed, 21 May 2014 11:59:52 +1200 Subject: [PATCH] Change URL shorteners. --- tinyurl.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tinyurl.py b/tinyurl.py index fed7a9d..8133355 100755 --- a/tinyurl.py +++ b/tinyurl.py @@ -103,15 +103,18 @@ def tinyurl(x): if x.startswith("http://tinyurl.com") \ or x.startswith("http://preview.tinyurl.com") \ or x.startswith("http://is.gd") \ + or x.startswith("http://sla.ac/a/") \ or x.startswith("http://geek.cn"): realurl[x] = x return x if not debug: try: + f = fetch_url("http://sla.ac/a/api.php?url=" + urlencode(x)) + r = f.read() #f = fetch_url("http://is.gd/api.php?longurl=" + x.replace("%","%25")) #r = f.read() - f = fetch_url("http://geek.cn/create.php?type=raw&url="+urlencode(x)) - r = f.read() + #f = fetch_url("http://geek.cn/create.php?type=raw&url="+urlencode(x)) + #r = f.read() print "url:",`x`,"tinyurl:",`r` tinycache[x] = r realurl[r] = x