diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-12-25 23:10:49 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-12-25 23:10:49 +0100 |
commit | ff6bf07fc99cea18ed140ca0a920fa0beabc30ce (patch) | |
tree | 0b464792a662633a9a3dceee37ce244f67c4a8d4 /plugins/manganelo.py | |
parent | deeb6917c9104a950e4829a35659a2231788eb2f (diff) |
Mangakakalot: try image second image server is chapter download fails
Diffstat (limited to 'plugins/manganelo.py')
-rwxr-xr-x | plugins/manganelo.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/plugins/manganelo.py b/plugins/manganelo.py index cfc8c9c..bbbe856 100755 --- a/plugins/manganelo.py +++ b/plugins/manganelo.py @@ -136,16 +136,19 @@ def list_chapters(url, chapter_list_input): print(json.dumps(chapters)) def download_chapter_images(url, download_dir, use_backup_server): - response = "" + cookies = {} try: - cookies = {} - if use_backup_server: - cookies = {"content_server": "server2"} - response = requests.get(url, timeout=30, cookies=cookies) + new_headers = headers.copy() + new_headers['referer'] = url + response = requests.get('https://mangakakalot.com/change_content_s2' if use_backup_server else 'https://mangakakalot.com/change_content_s1', headers=new_headers, allow_redirects=False) response.raise_for_status() + cookies = response.cookies except requests.HTTPError: return False + response = requests.get(url, timeout=30, headers=headers, cookies=cookies) + response.raise_for_status() + tree = etree.HTML(response.text) tree = redirect_migrated_url(url, tree, True) if tree is None: @@ -189,7 +192,8 @@ if command == "list": if len(sys.argv) < 3: usage_list() - url = sys.argv[2].replace("mangakakalot", "manganelo") + #url = sys.argv[2].replace("mangakakalot", "manganelo") + url = sys.argv[2] chapter_list_input = sys.stdin.read() if len(chapter_list_input) == 0: chapter_list_input = [] @@ -200,7 +204,8 @@ elif command == "download": if len(sys.argv) < 4: usage_download() - url = sys.argv[2].replace("mangakakalot", "manganelo") + #url = sys.argv[2].replace("mangakakalot", "manganelo") + url = sys.argv[2] download_dir = sys.argv[3] download_chapter(url, download_dir) else: |