From fcdd799d100410c2d03ddbb04daf6af41058f083 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 12 Jul 2012 09:48:00 -0500 Subject: [PATCH] Automatically try site without "www.". --- fanficdownloader/adapters/__init__.py | 5 +++++ fanficdownloader/adapters/adapter_themasquenet.py | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fanficdownloader/adapters/__init__.py b/fanficdownloader/adapters/__init__.py index eb59e9d..f628e15 100644 --- a/fanficdownloader/adapters/__init__.py +++ b/fanficdownloader/adapters/__init__.py @@ -121,6 +121,11 @@ def getAdapter(config,url,fileform=None): logging.debug("site:"+domain) cls = getClassFor(domain) + if not cls and domain.startswith("www."): + domain = domain.replace("www.","") + logging.debug("trying site:without www: "+domain) + cls = getClassFor(domain) + fixedurl = fixedurl.replace("http://www.","http://") if not cls: logging.debug("trying site:www."+domain) cls = getClassFor("www."+domain) diff --git a/fanficdownloader/adapters/adapter_themasquenet.py b/fanficdownloader/adapters/adapter_themasquenet.py index 5c14ed3..cc99f87 100644 --- a/fanficdownloader/adapters/adapter_themasquenet.py +++ b/fanficdownloader/adapters/adapter_themasquenet.py @@ -71,15 +71,11 @@ class TheMasqueNetAdapter(BaseSiteAdapter): # The site domain. Does have www here, if it uses it. return 'themasque.net' - @classmethod - def getAcceptDomains(cls): - return ['www.themasque.net','themasque.net'] # - def getSiteExampleURLs(self): return "http://themasque.net/wiktt/efiction/viewstory.php?sid=1234 http://themasque.net/efiction/viewstory.php?sid=1234" def getSiteURLPattern(self): - return re.escape("http://")+"(www\.)?"+re.escape(self.getSiteDomain())+"(/wiktt)?/efiction"+re.escape("/viewstory.php?sid=")+r"\d+$" + return re.escape("http://"+self.getSiteDomain())+"(/wiktt)?/efiction"+re.escape("/viewstory.php?sid=")+r"\d+$" ## Login seems to be reasonably standard across eFiction sites. def needToLoginCheck(self, data):