Skip to content

Instantly share code, notes, and snippets.

@akiross
Created August 3, 2022 15:40
Show Gist options
  • Save akiross/c0df732ee5cfd51b969d78730c48ce0d to your computer and use it in GitHub Desktop.
Save akiross/c0df732ee5cfd51b969d78730c48ce0d to your computer and use it in GitHub Desktop.
Curl Pool DL
from multiprocessing import Pool
import fileinput
def download(url):
from subprocess import check_call
check_call(["curl", "--silent", "-O", url])
return url
if __name__ == '__main__':
with Pool(20) as p:
urls = [l.strip() for l in fileinput.input()]
print("Read", len(urls), "urls", urls[0])
for url in p.imap(download, urls):
print("Downloaded", url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment