From e2a26837ef93fd9a448bc411b05c3c07723da257 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Mon, 14 Sep 2015 00:44:23 -0500 Subject: [PATCH] Typo and missing block in the Index class --- sites/spacebattles.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sites/spacebattles.py b/sites/spacebattles.py index 653eb9a..97e3c17 100644 --- a/sites/spacebattles.py +++ b/sites/spacebattles.py @@ -83,13 +83,17 @@ class SpaceBattles(Site): class SpaceBattlesIndex(SpaceBattles): """A spacebattles thread with an index post""" @staticmethod - def match(url): + def matches(url): return re.match(r'^https?://forums.(?:spacebattles|sufficientvelocity).com/posts/\d+/?.*', url) def _chapter_list(self, url): soup = self._soup(url) - post = post = soup.find('li', id='post-'+postid) + match = re.match(r'.+/posts/(\d+)/?', url) + if not match: + raise SiteException("Unparseable post URL", url) + + post = post = soup.find('li', id='post-' + match.group(1)) links = post.find('blockquote', class_='messageText').find_all('a', class_='internalLink') if not links: raise SiteException("No links in index?")