From 36dcf308d36a48f709e5dede2520d64f2bb67fb7 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 23 Apr 2012 07:44:25 +1200 Subject: [PATCH] Changed method of adding http:// sot URLS --- plugins/urlparse.py | 2 +- plugins/util/web.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/urlparse.py b/plugins/urlparse.py index b4f47d5..5fc63dc 100755 --- a/plugins/urlparse.py +++ b/plugins/urlparse.py @@ -8,7 +8,7 @@ def get_title(url): url = urlnorm.normalize(url.encode('utf-8')) url = url.decode('utf-8') # add http if its missing - if not url.startswith("http"): + if not "://" in url: url = "http://" + url try: # get the title diff --git a/plugins/util/web.py b/plugins/util/web.py index 1c550b5..f3d9700 100755 --- a/plugins/util/web.py +++ b/plugins/util/web.py @@ -14,9 +14,7 @@ class ShortenError(Exception): def bitly(url, user, api_key): """ shortens a URL with the bit.ly API """ - if url[:8] == "https://": - pass - elif url[:7] != "http://": + if not "://" in url: url = "http://" + url params = urlencode({'longUrl': url, 'login': user, 'apiKey': api_key, 'format': 'json'})