diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-12 20:15:57 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-12 20:15:57 +0200 |
commit | 85b76ba1c4f789549e7a6e8acc1507ef3938891d (patch) | |
tree | 7799986e30818a16b9b414be8a009430d929f4fd /plugins | |
parent | 7a1b58912d16e181cef750493d4510f8bea40e97 (diff) |
Fix mangadex download with input list
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/mangadex.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/mangadex.py b/plugins/mangadex.py index 2eeeaa5..5b7ecd3 100755 --- a/plugins/mangadex.py +++ b/plugins/mangadex.py @@ -79,7 +79,8 @@ def list_chapters(url, chapter_list_input): i = 0 prev_chapter_number = "" chapters = [] - while True: + finished = False + while not finished: url = "https://api.mangadex.org/manga/" + manga_id + "/feed?&limit=100&offset=%d&locales[]=%s&order[chapter]=desc" % (i * 100, lang) response = requests.get(url, headers=headers) response.raise_for_status() @@ -115,19 +116,17 @@ def list_chapters(url, chapter_list_input): title = title.replace("/", "_") if title.lower().replace(" ", "") in seen_titles or id in seen_urls: + finished = True break if chapter_number_str in seen_chapter_numbers: + finished = True break - chapters.append({ "name": title, "url": id, "chapter": int(chapter_number_str) }) + chapters.append({ "name": title, "url": id }) i += 1 - chapters = sorted(chapters, key=sort_chapters, reverse=True) - output_chapters = [] - for chapter in chapters: - output_chapters.append({ "name": chapter["name"], "url": chapter["url"] }) - print(json.dumps(output_chapters)) + print(json.dumps(chapters)) def get_base_url_for_chapter(chapter_id): response = requests.get("https://api.mangadex.org/at-home/server/" + chapter_id, headers=headers) |