1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2025-12-06 08:22:56 +01:00

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.
This commit is contained in:
Alex Raubach 2018-08-28 21:59:16 -04:00 committed by GitHub
parent b83b6d37f1
commit 2019616505
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: