From 2019616505e571ead6a4da06fc71e30ae9ec2e07 Mon Sep 17 00:00:00 2001 From: Alex Raubach <10493887+AlexRaubach@users.noreply.github.com> Date: Tue, 28 Aug 2018 21:59:16 -0400 Subject: [PATCH] Check that the chapter has content before parsing Trying to select the first element in line 87 will throw a list index out of range error if there is no content matching the selector. --- sites/arbitrary.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sites/arbitrary.py b/sites/arbitrary.py index 1989bc6..6f401a2 100644 --- a/sites/arbitrary.py +++ b/sites/arbitrary.py @@ -80,6 +80,10 @@ class Arbitrary(Site): # Probably by changing it so that this returns a Chapter / Section. logger.info("Extracting chapter @ %s", url) soup = self._soup(url) + + if not soup.select(definition.content_selector): + return '' + content = soup.select(definition.content_selector)[0] if definition.filter_selector: