From 64f693379da844db3a7b90652c283884a95550d0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 20 Nov 2020 17:36:04 +0100 Subject: Mangaplus: remove headers to fix download --- plugins/mangaplus.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'plugins') 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) -- cgit v1.2.3