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

Don't prettify royalroad soup, Fixes #92

This commit is contained in:
KeinNiemand 2023-05-04 13:17:28 +02:00
parent 6895a0eb61
commit 356bae9a7a

View file

@ -73,18 +73,18 @@ class RoyalRoad(Site):
self._clean(content) self._clean(content)
self._clean_spoilers(content, chapterid) self._clean_spoilers(content, chapterid)
content = content.prettify() content = str(content)
author_note = soup.find_all('div', class_='author-note-portlet') author_note = soup.find_all('div', class_='author-note-portlet')
if len(author_note) == 1: if len(author_note) == 1:
# Find the parent of chapter-content and check if the author's note is the first child div # Find the parent of chapter-content and check if the author's note is the first child div
if 'author-note-portlet' in soup.find('div', class_='chapter-content').parent.find('div')['class']: if 'author-note-portlet' in soup.find('div', class_='chapter-content').parent.find('div')['class']:
content = author_note[0].prettify() + '<hr/>' + content content = str(author_note[0]) + '<hr/>' + content
else: # The author note must be after the chapter content else: # The author note must be after the chapter content
content = content + '<hr/>' + author_note[0].prettify() content = content + '<hr/>' + str(author_note[0])
elif len(author_note) == 2: elif len(author_note) == 2:
content = author_note[0].prettify() + '<hr/>' + content + '<hr/>' + author_note[1].prettify() content = str(author_note[0]) + '<hr/>' + content + '<hr/>' + str(author_note[1])
updated = datetime.datetime.fromtimestamp( updated = datetime.datetime.fromtimestamp(
int(soup.find(class_="profile-info").find('time').get('unixtime')) int(soup.find(class_="profile-info").find('time').get('unixtime'))