Skip to content

Instantly share code, notes, and snippets.

@sk0x1234
Last active July 14, 2023 18:48
Show Gist options
  • Save sk0x1234/77c5cfe53aaf455ca9ec120a11acfa09 to your computer and use it in GitHub Desktop.
Save sk0x1234/77c5cfe53aaf455ca9ec120a11acfa09 to your computer and use it in GitHub Desktop.
script
import requests
import pathlib
with open("files.txt","r") as f:
urls = [ url.rstrip() for url in f.readlines()]
files_to_download = []
for url in urls:
if ".zip" in url:
continue
else:
files_to_download.append(url)
def download(url) :
print(url)
req = requests.get(url,stream=True)
req.raise_for_status()
filename=pathlib.PurePosixPath(url).name
with open(filename, "wb" ) as f :
f.write(req.content)
# except requests.HTTPError.errno as err:
# print(err)
# exit(1)
if __name__ == "__main__" :
for url in files_to_download:
#print(files_to_download[:5])
download(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment