From ecfe1f35a8038347525f0674cfc618d797c35fdd Mon Sep 17 00:00:00 2001 From: David Lynch Date: Wed, 28 Oct 2015 11:03:45 -0500 Subject: [PATCH] Fix bug with postid finding --- sites/spacebattles.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/spacebattles.py b/sites/spacebattles.py index de98f53..d1da52a 100644 --- a/sites/spacebattles.py +++ b/sites/spacebattles.py @@ -30,6 +30,7 @@ class SpaceBattles(Site): continue if not href.startswith('http'): href = base + href + print("Fetching chapter", mark.string, href) chapters.append((str(mark.string), self._chapter(href))) story['chapters'] = chapters @@ -71,7 +72,6 @@ class SpaceBattles(Site): return links def _chapter(self, url): - print("Extracting chapter from", url) post = self._post_from_url(url) return self._clean_chapter(post) @@ -79,7 +79,7 @@ class SpaceBattles(Site): def _post_from_url(self, url): # URLs refer to specific posts, so get just that one # if no specific post referred to, get the first one - match = re.match(r'posts/(\d+)/?', url) + match = re.search(r'posts/(\d+)/?', url) if not match: match = re.match(r'.+#post-(\d+)$', url) # could still be nothing here