aboutsummaryrefslogtreecommitdiff
path: root/plugins/mangadex.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mangadex.py')
-rwxr-xr-xplugins/mangadex.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/mangadex.py b/plugins/mangadex.py
index f39ceb4..da81bc4 100755
--- a/plugins/mangadex.py
+++ b/plugins/mangadex.py
@@ -36,7 +36,7 @@ if len(sys.argv) < 2:
usage()
def download_file(url, save_path):
- with requests.get(url, headers=headers, stream=True) as response:
+ with requests.get(url, headers=headers, stream=True, timeout=30) as response:
if not response.ok:
return False
with open(save_path, "wb") as file:
@@ -82,7 +82,7 @@ def list_chapters(url, chapter_list_input):
finished = False
while not finished:
url = "https://api.mangadex.org/manga/" + manga_id + "/feed?&limit=100&offset=%d&translatedLanguage[]=%s&order[chapter]=desc" % (i * 100, lang)
- response = requests.get(url, headers=headers)
+ response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
if len(response.text) == 0:
@@ -129,13 +129,13 @@ def list_chapters(url, chapter_list_input):
print(json.dumps(chapters))
def get_base_url_for_chapter(chapter_id):
- response = requests.get("https://api.mangadex.org/at-home/server/" + chapter_id, headers=headers)
+ response = requests.get("https://api.mangadex.org/at-home/server/" + chapter_id, headers=headers, timeout=30)
response.raise_for_status()
return response.json()["baseUrl"]
def download_chapter(url, download_dir):
base_url = get_base_url_for_chapter(url)
- response = requests.get("https://api.mangadex.org/chapter/" + url, headers=headers)
+ response = requests.get("https://api.mangadex.org/chapter/" + url, headers=headers, timeout=30)
response.raise_for_status()
image_urls = []