mirror of
https://github.com/kemayo/leech
synced 2025-12-15 21:05:59 +01:00
Avoid double-fetching the chapter contents
Doesn't matter hugely if caching is enabled, but it's still suboptimal.
This commit is contained in:
parent
23b76d2aac
commit
69c9c21f47
1 changed files with 5 additions and 5 deletions
|
|
@ -39,11 +39,9 @@ class RoyalRoad(Site):
|
|||
|
||||
# Have to get exact publishing time from the chapter page
|
||||
chapter_soup = self._soup(chapter_url)
|
||||
updated = datetime.datetime.fromtimestamp(
|
||||
int(chapter_soup.find(class_="profile-info").find('time').get('unixtime')),
|
||||
)
|
||||
contents, updated = self._chapter(chapter_url)
|
||||
|
||||
story.add(Chapter(title=chapter.find('a', href=True).string.strip(), contents=self._chapter(chapter_url), date=updated))
|
||||
story.add(Chapter(title=chapter.find('a', href=True).string.strip(), contents=contents, date=updated))
|
||||
|
||||
http.client._MAXHEADERS = original_maxheaders
|
||||
|
||||
|
|
@ -56,5 +54,7 @@ class RoyalRoad(Site):
|
|||
|
||||
# TODO: this could be more robust, and I don't know if there's post-chapter notes anywhere as well.
|
||||
author_note = soup.find('div', class_='author-note-portlet')
|
||||
|
||||
updated = int(soup.find(class_="profile-info").find('time').get('unixtime'))
|
||||
|
||||
return (author_note and (author_note.prettify() + '<hr/>') or '') + content.prettify()
|
||||
return (author_note and (author_note.prettify() + '<hr/>') or '') + content.prettify(), updated
|
||||
|
|
|
|||
Loading…
Reference in a new issue