1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2025-12-28 11:13:28 +01:00

AO3 single-chapter story bugs

This commit is contained in:
David Lynch 2023-03-31 23:51:27 -05:00
parent fe5ca86d87
commit 6895a0eb61

View file

@ -58,7 +58,10 @@ class ArchiveOfOurOwn(Site):
# Fetch the chapter list as well because it contains info that's not in the full work
nav_soup = self._soup(f'https://archiveofourown.org/works/{workid}/navigate')
chapters = soup.find_all(id=re.compile(r"chapter-\d+"))
chapters = soup.select('#chapters > div')
if len(chapters) == 1:
# in a single-chapter story the #chapters div is actually the chapter
chapters = [soup.find(id='chapters').parent]
for index, chapter in enumerate(nav_soup.select('#main ol[role="navigation"] li')):
link = chapter.find('a')