From f05bfb51ef08fe27771b864eb9375979d4745d89 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Tue, 10 Aug 2021 17:15:18 -0500 Subject: [PATCH] AO3: work if www is present in the URL --- sites/ao3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/ao3.py b/sites/ao3.py index dd182c7..34ac753 100644 --- a/sites/ao3.py +++ b/sites/ao3.py @@ -16,7 +16,7 @@ class ArchiveOfOurOwn(Site): @staticmethod def matches(url): # e.g. http://archiveofourown.org/works/5683105/chapters/13092007 - match = re.match(r'^(https?://archiveofourown\.org/works/\d+)/?.*', url) + match = re.match(r'^(https?://(?:www\.)?archiveofourown\.org/works/\d+)/?.*', url) if match: return match.group(1) + '/' @@ -43,7 +43,7 @@ class ArchiveOfOurOwn(Site): logger.info("Logged in as %s", login_details[0]) def extract(self, url): - workid = re.match(r'^https?://archiveofourown\.org/works/(\d+)/?.*', url).group(1) + workid = re.match(r'^https?://(?:www\.)?archiveofourown\.org/works/(\d+)/?.*', url).group(1) return self._extract_work(workid) def _extract_work(self, workid):