aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-12-25 23:10:49 +0100
committerdec05eba <dec05eba@protonmail.com>2024-12-25 23:10:49 +0100
commitff6bf07fc99cea18ed140ca0a920fa0beabc30ce (patch)
tree0b464792a662633a9a3dceee37ce244f67c4a8d4
parentdeeb6917c9104a950e4829a35659a2231788eb2f (diff)
Mangakakalot: try image second image server is chapter download fails
-rw-r--r--TODO1
-rwxr-xr-xplugins/manganelo.py19
2 files changed, 13 insertions, 7 deletions
diff --git a/TODO b/TODO
index a8d1872..375c795 100644
--- a/TODO
+++ b/TODO
@@ -15,3 +15,4 @@ Remove torrents when running automedia cleanup. This can be done by removing tor
Use fallbacks for manga download too.
Put anime and manga downloads into separate subdirectories in the download directory.
+Automatically cleanup downloaded (and seeded) torrents in transmission.
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: