diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-20 17:36:04 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-20 17:36:04 +0100 |
commit | 64f693379da844db3a7b90652c283884a95550d0 (patch) | |
tree | 929eda1c52280b42ecb183058fbef9c993d382eb /plugins | |
parent | e1825f3920385b018f3679cc216314110e62bb05 (diff) |
Mangaplus: remove headers to fix download
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/mangaplus.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/plugins/mangaplus.py b/plugins/mangaplus.py index 23bae04..7104d80 100755 --- a/plugins/mangaplus.py +++ b/plugins/mangaplus.py @@ -9,7 +9,6 @@ import time import sys import re import requests -import uuid import json from pure_protobuf.dataclasses_ import field, message @@ -21,13 +20,6 @@ from typing import List RE_ENCRYPTION_KEY = re.compile('.{1,2}') -headers = { - 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36", - 'Origin': 'https://mangaplus.shueisha.co.jp', - 'Referer': 'https://mangaplus.shueisha.co.jp', - 'SESSION-TOKEN': repr(uuid.uuid1()), -} - api_url = 'https://jumpg-webapi.tokyo-cdn.com/api' api_manga_url = api_url + '/title_detail?title_id={0}' api_chapter_url = api_url + '/manga_viewer?chapter_id={0}&split=yes&img_quality=high' @@ -181,7 +173,7 @@ def download_file(url, page, save_path): block_size_in_bytes = len(key_stream) index = 0 - with requests.get(url, headers=headers, stream=True) as response: + with requests.get(url, stream=True) as response: if not response.ok: return False with open(save_path, "wb") as file: @@ -191,7 +183,7 @@ def download_file(url, page, save_path): file.write(content) index += len(chunk) else: - with requests.get(url, headers=headers, stream=True) as response: + with requests.get(url, stream=True) as response: if not response.ok: return False with open(save_path, "wb") as file: @@ -213,7 +205,7 @@ def list_chapters(url, chapter_list_input): url = api_manga_url.format(manga_id) - response = requests.get(url, headers=headers) + response = requests.get(url) if response.status_code != 200: print("Failed to list chapters, server responded with status code %d" % response.status_code) exit(2) @@ -264,7 +256,7 @@ def download_chapter(url, download_dir): url = api_chapter_url.format(manga_id) - response = requests.get(url, headers=headers) + response = requests.get(url) if response.status_code != 200: print("Failed to list chapter images, server responded with status code %d" % response.status_code) exit(2) |