diff options
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) |