Skip to content

Instantly share code, notes, and snippets.

@shaabhishek
Created April 26, 2020 15:51
Show Gist options
  • Save shaabhishek/cc722d24475c0c13d6de168fa39c221f to your computer and use it in GitHub Desktop.
Save shaabhishek/cc722d24475c0c13d6de168fa39c221f to your computer and use it in GitHub Desktop.
Script to download files in batch mode
from urllib.request import urlretrieve
from pathlib import Path
import time
import random
slides_dir = Path('/blablabla/CS590M/slides')
url = lambda n: f"https://blabla.com/slecture{n:02}h.pdf"
fname = lambda n: slides_dir / f"slecture{n:02}h.pdf"
urlfname = lambda n: (url(n), fname(n))
for i in range(1, 13):
urlretrieve(*urlfname(i))
time.sleep(0.1 + random.random())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment