Fixed not downloading

This commit is contained in:
Blue Fox 2022-09-10 13:19:26 +02:00
parent b729fb9a3d
commit ed6964d5aa

8
http_downloader.py Normal file → Executable file
View File

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