Skip to content

Commit

Permalink
Merge pull request #2257 from camp00000/bato
Browse files Browse the repository at this point in the history
bato: fix empty chapters
  • Loading branch information
dipu-bd committed Feb 9, 2024
2 parents ff5bea5 + bd7f2da commit 7b64063
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions sources/en/b/bato.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,17 @@ def download_chapter_body(self, chapter):

bato_word = re.search(r"const batoWord = (.*);", soup.text).group(1).strip('"')

# looks like some kind of "access" GET args that may be necessary, not always though
query_args = json.loads(decrypt(bato_word, bato_pass).decode())

image_urls = [
f'<img src="{img}?{args}">' for img, args in zip(img_list, query_args)
]
# so if it ends up empty or mismatches, just ignore it and return the img list instead
if len(query_args) != len(img_list):
image_urls = [
f'<img src="{img}" alt="img">' for img in img_list
]
else:
image_urls = [
f'<img src="{img}?{args}">' for img, args in zip(img_list, query_args)
]

return "<p>" + "</p><p>".join(image_urls) + "</p>"

0 comments on commit 7b64063

Please sign in to comment.