aboutsummaryrefslogtreecommitdiff
path: root/plugins/manganelo.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/manganelo.py')
-rwxr-xr-xplugins/manganelo.py19
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: