From d1b73b9a6ac4364a28822725d271cf4174c9115a Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Wed, 18 Jun 2014 21:28:42 -0500 Subject: [PATCH] Auto-add http: to URLs starting with //. --- fanficdownloader/adapters/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fanficdownloader/adapters/__init__.py b/fanficdownloader/adapters/__init__.py index 52340dc9..3d4b0a20 100644 --- a/fanficdownloader/adapters/__init__.py +++ b/fanficdownloader/adapters/__init__.py @@ -209,6 +209,8 @@ def getConfigSectionFor(url): def getClassFor(url): ## fix up leading protocol. fixedurl = re.sub(r"(?i)^[htp]+(s?)[:/]+",r"http\1://",url.strip()) + if fixedurl.startswith("//"): + fixedurl = "http:%s"%url if not fixedurl.startswith("http"): fixedurl = "http://%s"%url ## remove any trailing '#' locations.