From ed6964d5aa886d585da49ceea7df3a819e368083 Mon Sep 17 00:00:00 2001 From: Blue Fox Date: Sat, 10 Sep 2022 13:19:26 +0200 Subject: [PATCH] Fixed not downloading --- http_downloader.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 http_downloader.py diff --git a/http_downloader.py b/http_downloader.py old mode 100644 new mode 100755 index b16ee7b..a3ddc85 --- a/http_downloader.py +++ b/http_downloader.py @@ -30,11 +30,13 @@ if __name__ == "__main__": print(f"Opened {sys.argv[1]}, reading...") urls = f.readlines() for url in urls: + url = url[:len(url)-1] # remove the newline at the end print(f"Getting {url}: ", end="") # print text, without newline at the end - returncode = subprocess.run(["wget", url], shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).returncode - if returncode != 0: + proc = subprocess.run([f"wget \"{url}\""], shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE) + if proc.returncode != 0: print(f"not a valid URL/not existent, skipping!") - print("100%.") + else: + print("100%.") except FileNotFoundError: print(f"File \"{sys.argv[1]}\" could not be found, maybe not a file or path badly specified?")