aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xplugins/lhtranslation.py4
-rwxr-xr-xplugins/mangadex.py8
-rwxr-xr-xplugins/mangakatana.py6
-rwxr-xr-xplugins/manganelo.py6
-rwxr-xr-xplugins/manganelos.py6
-rwxr-xr-xplugins/mangaplus.py8
-rwxr-xr-xplugins/mangatown.py8
-rwxr-xr-xplugins/readm.py6
8 files changed, 26 insertions, 26 deletions
diff --git a/plugins/lhtranslation.py b/plugins/lhtranslation.py
index ac32f5f..39540f0 100755
--- a/plugins/lhtranslation.py
+++ b/plugins/lhtranslation.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:
@@ -73,7 +73,7 @@ def list_chapters(url, chapter_list_input):
print(json.dumps(chapters))
def download_chapter(url, download_dir):
- response = requests.get(url, headers=headers)
+ response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
in_progress_filepath = os.path.join(download_dir, ".in_progress")
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 = []
diff --git a/plugins/mangakatana.py b/plugins/mangakatana.py
index e259302..02337d1 100755
--- a/plugins/mangakatana.py
+++ b/plugins/mangakatana.py
@@ -36,7 +36,7 @@ if len(sys.argv) < 2:
def download_file(url, save_path):
file_size = 0
- 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 0
with open(save_path, "wb") as file:
@@ -47,7 +47,7 @@ def download_file(url, save_path):
return file_size
def list_chapters(url, chapter_list_input):
- response = requests.get(url, headers=headers)
+ response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
seen_titles = set()
@@ -74,7 +74,7 @@ def list_chapters(url, chapter_list_input):
print(json.dumps(chapters))
def download_chapter(url, download_dir):
- response = requests.get(url)
+ response = requests.get(url, timeout=30)
response.raise_for_status()
in_progress_filepath = os.path.join(download_dir, ".in_progress")
diff --git a/plugins/manganelo.py b/plugins/manganelo.py
index 3b86397..312d093 100755
--- a/plugins/manganelo.py
+++ b/plugins/manganelo.py
@@ -44,7 +44,7 @@ def download_file(url, save_path):
#cookies = {
# "content_server": "server2"
#}
- with requests.get(url, stream=True, headers=headers) as response:
+ with requests.get(url, stream=True, headers=headers, timeout=30) as response:
if not response.ok:
return 0
with open(save_path, "wb") as file:
@@ -55,7 +55,7 @@ def download_file(url, save_path):
return file_size
def list_chapters(url, chapter_list_input):
- response = requests.get(url)
+ response = requests.get(url, timeout=30)
response.raise_for_status()
seen_titles = set()
@@ -81,7 +81,7 @@ def list_chapters(url, chapter_list_input):
print(json.dumps(chapters))
def download_chapter(url, download_dir):
- response = requests.get(url)
+ response = requests.get(url, timeout=30)
response.raise_for_status()
in_progress_filepath = os.path.join(download_dir, ".in_progress")
diff --git a/plugins/manganelos.py b/plugins/manganelos.py
index f138c4f..8ff551a 100755
--- a/plugins/manganelos.py
+++ b/plugins/manganelos.py
@@ -36,7 +36,7 @@ if len(sys.argv) < 2:
def download_file(url, save_path):
file_size = 0
- 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 0
with open(save_path, "wb") as file:
@@ -47,7 +47,7 @@ def download_file(url, save_path):
return file_size
def list_chapters(url, chapter_list_input):
- response = requests.get(url, headers=headers)
+ response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
seen_titles = set()
@@ -74,7 +74,7 @@ def list_chapters(url, chapter_list_input):
print(json.dumps(chapters))
def download_chapter(url, download_dir):
- response = requests.get(url)
+ response = requests.get(url, timeout=30)
response.raise_for_status()
in_progress_filepath = os.path.join(download_dir, ".in_progress")
diff --git a/plugins/mangaplus.py b/plugins/mangaplus.py
index 05567fc..7dee0d8 100755
--- a/plugins/mangaplus.py
+++ b/plugins/mangaplus.py
@@ -173,7 +173,7 @@ def download_file(url, page, save_path):
block_size_in_bytes = len(key_stream)
index = 0
- with requests.get(url, stream=True) as response:
+ with requests.get(url, stream=True, timeout=30) as response:
if not response.ok:
return False
with open(save_path, "wb") as file:
@@ -183,7 +183,7 @@ def download_file(url, page, save_path):
file.write(content)
index += len(chunk)
else:
- with requests.get(url, stream=True) as response:
+ with requests.get(url, stream=True, timeout=30) as response:
if not response.ok:
return False
with open(save_path, "wb") as file:
@@ -205,7 +205,7 @@ def list_chapters(url, chapter_list_input):
url = api_manga_url.format(manga_id)
- response = requests.get(url)
+ response = requests.get(url, timeout=30)
response.raise_for_status()
resp = MangaplusResponse.loads(response.content)
@@ -254,7 +254,7 @@ def download_chapter(url, download_dir):
url = api_chapter_url.format(manga_id)
- response = requests.get(url)
+ response = requests.get(url, timeout=30)
response.raise_for_status()
in_progress_filepath = os.path.join(download_dir, ".in_progress")
diff --git a/plugins/mangatown.py b/plugins/mangatown.py
index 0740925..29a58ab 100755
--- a/plugins/mangatown.py
+++ b/plugins/mangatown.py
@@ -36,7 +36,7 @@ if len(sys.argv) < 2:
def download_file(url, save_path):
file_size = 0
- 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 0
with open(save_path, "wb") as file:
@@ -47,7 +47,7 @@ def download_file(url, save_path):
return file_size
def list_chapters(url, chapter_list_input):
- response = requests.get(url, headers=headers)
+ response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
seen_titles = set()
@@ -86,7 +86,7 @@ def download_chapter(url, download_dir):
if not url[-1] == '/':
url += '/'
- response = requests.get(url, headers=headers)
+ response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
in_progress_filepath = os.path.join(download_dir, ".in_progress")
@@ -135,7 +135,7 @@ def download_chapter(url, download_dir):
next_page_url = url + next_page_urls[0]
page_url = next_page_url
- response = requests.get(page_url, headers=headers)
+ response = requests.get(page_url, headers=headers, timeout=30)
if not response.ok:
print("Failed to get next page for chapter")
os.remove(in_progress_filepath)
diff --git a/plugins/readm.py b/plugins/readm.py
index 59b8125..2b4dffb 100755
--- a/plugins/readm.py
+++ b/plugins/readm.py
@@ -36,7 +36,7 @@ if len(sys.argv) < 2:
def download_file(url, save_path):
file_size = 0
- 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 0
with open(save_path, "wb") as file:
@@ -47,7 +47,7 @@ def download_file(url, save_path):
return file_size
def list_chapters(url, chapter_list_input):
- response = requests.get(url, headers=headers)
+ response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
seen_titles = set()
@@ -75,7 +75,7 @@ def list_chapters(url, chapter_list_input):
print(json.dumps(chapters))
def download_chapter(url, download_dir):
- response = requests.get(url)
+ response = requests.get(url, timeout=30)
response.raise_for_status()
in_progress_filepath = os.path.join(download_dir, ".in_progress")