Fixed not downloading
This commit is contained in:
parent
b729fb9a3d
commit
ed6964d5aa
8
http_downloader.py
Normal file → Executable file
8
http_downloader.py
Normal file → Executable file
@ -30,11 +30,13 @@ if __name__ == "__main__":
|
|||||||
print(f"Opened {sys.argv[1]}, reading...")
|
print(f"Opened {sys.argv[1]}, reading...")
|
||||||
urls = f.readlines()
|
urls = f.readlines()
|
||||||
for url in urls:
|
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
|
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
|
proc = subprocess.run([f"wget \"{url}\""], shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
|
||||||
if returncode != 0:
|
if proc.returncode != 0:
|
||||||
print(f"not a valid URL/not existent, skipping!")
|
print(f"not a valid URL/not existent, skipping!")
|
||||||
print("100%.")
|
else:
|
||||||
|
print("100%.")
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(f"File \"{sys.argv[1]}\" could not be found, maybe not a file or path badly specified?")
|
print(f"File \"{sys.argv[1]}\" could not be found, maybe not a file or path badly specified?")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user