Skip to content

Commit

Permalink
support single chapter volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliosLHC authored Aug 20, 2023
1 parent 989e014 commit 387b2b0
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 387b2b0

Please sign in to comment.