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:
parent
b83b6d37f1
commit
2019616505
1 changed files with 4 additions and 0 deletions
|
|
@ -80,6 +80,10 @@ class Arbitrary(Site):
|
||||||
# Probably by changing it so that this returns a Chapter / Section.
|
# Probably by changing it so that this returns a Chapter / Section.
|
||||||
logger.info("Extracting chapter @ %s", url)
|
logger.info("Extracting chapter @ %s", url)
|
||||||
soup = self._soup(url)
|
soup = self._soup(url)
|
||||||
|
|
||||||
|
if not soup.select(definition.content_selector):
|
||||||
|
return ''
|
||||||
|
|
||||||
content = soup.select(definition.content_selector)[0]
|
content = soup.select(definition.content_selector)[0]
|
||||||
|
|
||||||
if definition.filter_selector:
|
if definition.filter_selector:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue