From 44ebc4333645547af146dbfd57b3891b92112d86 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 9 Jan 2022 14:08:11 +0100 Subject: Mangadex images download after at-home endpoint update --- plugins/mangadex.py | 12 ++++++------ plugins/mangaplus.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/mangadex.py b/plugins/mangadex.py index da81bc4..1b75097 100755 --- a/plugins/mangadex.py +++ b/plugins/mangadex.py @@ -134,8 +134,7 @@ def get_base_url_for_chapter(chapter_id): return response.json()["baseUrl"] def download_chapter(url, download_dir): - base_url = get_base_url_for_chapter(url) - response = requests.get("https://api.mangadex.org/chapter/" + url, headers=headers, timeout=30) + response = requests.get("https://api.mangadex.org/at-home/server/" + url, headers=headers, timeout=30) response.raise_for_status() image_urls = [] @@ -144,10 +143,11 @@ def download_chapter(url, download_dir): print("Got item with result != ok") exit(1) - data = json_response["data"] - attributes = data["attributes"] - hash = attributes["hash"] - image_names = attributes["data"] + base_url = json_response["baseUrl"] + chapter = json_response["chapter"] + data = chapter["data"] + hash = chapter["hash"] + image_names = chapter["data"] for image_name in image_names: image_urls.append(base_url + "/data/" + hash + "/" + image_name) diff --git a/plugins/mangaplus.py b/plugins/mangaplus.py index 7dee0d8..9b11eda 100755 --- a/plugins/mangaplus.py +++ b/plugins/mangaplus.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -# The page decryption in this file is based on komikku/servers/mangaplus.py -# available at https://gitlab.com/valos/Komikku/-/blob/master/komikku/servers/mangaplus.py +# The page decryption in this file is based on komikku/servers/mangaplus/__init__.py +# available at https://gitlab.com/valos/Komikku/-/blob/master/komikku/servers/mangaplus/__init__.py # which is licensed under GPL 3.0 import os -- cgit v1.2.3