Created
August 3, 2022 15:40
Curl Pool DL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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