aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-10-28 20:11:36 +0200
committerdec05eba <dec05eba@protonmail.com>2022-10-28 20:11:36 +0200
commit3767bb74de0926cbb24afc709a249f62b858b7a8 (patch)
tree222ed9d28cb8f034d585bcc946cc8cf91af9dd89
parentbdb699135b7144d86a71bb154bfe069d75715102 (diff)
Revert "Mangakatana: use i3 server instead of i2 because its borked"
This reverts commit bdb699135b7144d86a71bb154bfe069d75715102.
-rwxr-xr-xplugins/mangakatana.py24
1 files changed, 10 insertions, 14 deletions
diff --git a/plugins/mangakatana.py b/plugins/mangakatana.py
index e7e0604..85fd8d0 100755
--- a/plugins/mangakatana.py
+++ b/plugins/mangakatana.py
@@ -36,19 +36,15 @@ if len(sys.argv) < 2:
def download_file(url, save_path):
file_size = 0
- try:
- with requests.get(url, headers=headers, stream=True, timeout=30) as response:
- if not response.ok:
- return 0
- with open(save_path, "wb") as file:
- for chunk in response.iter_content(chunk_size=8192):
- if chunk:
- file.write(chunk)
- file_size += len(chunk)
- return file_size
- except requests.exceptions.ChunkedEncodingError as e:
- print("Warning: error while downloading %s: %s" % (url, str(e)))
- return 0
+ with requests.get(url, headers=headers, stream=True, timeout=30) as response:
+ if not response.ok:
+ return 0
+ with open(save_path, "wb") as file:
+ for chunk in response.iter_content(chunk_size=8192):
+ if chunk:
+ file.write(chunk)
+ file_size += len(chunk)
+ return file_size
def list_chapters(url, chapter_list_input):
response = requests.get(url, headers=headers, timeout=30)
@@ -150,9 +146,9 @@ def download_chapter(url, download_dir):
ext = image_source[image_source.rfind("."):]
image_name = str(img_number) + ext
image_path = os.path.join(download_dir, image_name)
- image_source = image_source.replace("://i1", "://i3")
print("Downloading {} to {}".format(image_source, image_path))
if not download_file(image_source, image_path):
+ image_source = image_source.replace("://i3", "://i2")
if not download_file(image_source, image_path):
print("Failed to download image: %s" % image_source)
os.remove(in_progress_filepath)