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?")