Skip to content

Commit

Permalink
Better error for an Arbitrary story that fetches no content
Browse files Browse the repository at this point in the history
  • Loading branch information
kemayo committed Nov 24, 2024
1 parent 85da618 commit ffb8e54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions leech.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ def open_story(site, url, session, login, options):
try:
story = handler.extract(url)
except sites.SiteException as e:
logger.error(e.args)
logger.error(e)
return
if not story:
raise Exception("Couldn't extract story")
logger.error("Couldn't extract story")
return story


Expand Down
5 changes: 4 additions & 1 deletion sites/arbitrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
import re
import os.path
from . import register, Site, Section, Chapter
from . import register, Site, Section, Chapter, SiteException

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -94,6 +94,9 @@ def extract(self, url):
else:
content_url = False

if not story:
raise SiteException("No story content found; check the content selectors")

return story

def _chapter(self, url, definition, title=False):
Expand Down

0 comments on commit ffb8e54

Please sign in to comment.