mirror of
https://github.com/kemayo/leech
synced 2025-12-06 08:22:56 +01:00
Add a null check to RR author note placement
This commit is contained in:
parent
cf62faf5dd
commit
a9dfdb5dd3
1 changed files with 3 additions and 2 deletions
|
|
@ -55,8 +55,9 @@ class RoyalRoad(Site):
|
|||
author_note = soup.find_all('div', class_='author-note-portlet')
|
||||
|
||||
if len(author_note) is 1:
|
||||
# The first child div is either the chapter content or an author note
|
||||
if 'author-note-portlet' in soup.find('div', class_='portlet-body').find('div', recursive=False)['class']:
|
||||
# The first child div of portlet-body is either the chapter content or an author note
|
||||
first_div = soup.find('div', class_='portlet-body').find('div', recursive=False)
|
||||
if first_div and ('author-note-portlet' in first_div['class']):
|
||||
content = author_note[0].prettify() + '<hr/>' + content
|
||||
else: # The author note must be after the chapter content
|
||||
content = content + '<hr/>' + author_note[0].prettify()
|
||||
|
|
|
|||
Loading…
Reference in a new issue