aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: