Skip to content

Commit

Permalink
Merge pull request #2051 from HeliosLHC/toc-qidian-fix
Browse files Browse the repository at this point in the history
support single chapter volumes
  • Loading branch information
dipu-bd authored Nov 14, 2023
2 parents bfe2ade + 387b2b0 commit c6f1c22
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions sources/en/q/qidianunderground.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,32 @@ def read_novel_info(self):

data = self.get_json(self.novel_url)
for vol_id, item in enumerate(data, 1):
start_ch, final_ch = re.findall(r"(\d+) - (\d+)", item["Text"])[0]
self.volumes.append(
{
"id": vol_id,
"title": "Chapters %s - %s" % (start_ch, final_ch),
}
)
for j in range(int(start_ch), int(final_ch) + 1):
if "-" in item["Text"]:
start_ch, final_ch = re.findall(r"(\d+) - (\d+)", item["Text"])[0]
self.volumes.append(
{
"id": vol_id,
"title": "Chapters %s - %s" % (start_ch, final_ch),
}
)
for j in range(int(start_ch), int(final_ch) + 1):
self.chapters.append(
{
"id": j,
"volume": vol_id,
"url": item["Href"],
}
)
else:
self.volumes.append(
{
"id": vol_id,
"title": "Chapters %s" % (item["Text"]),
}
)
self.chapters.append(
{
"id": j,
"id": int(item["Text"]),
"volume": vol_id,
"url": item["Href"],
}
Expand Down

0 comments on commit c6f1c22

Please sign in to comment.