This is because I'm really lazy and copying and pasteing into jupyter notebooks is less than fun when the images already exist in the outside world.... 😂
import requests
import json
from pathlib import Path
from tqdm.auto import tqdm
target = Path('img')
source = Path('images.json')
def get_image(url,name):
r = requests.get(url)
r.raise_for_status()
(target/name).write_bytes(r.content)
return True
images = json.loads(source.read_text())
for url,name in tqdm(images.items()):
get_image(url,name)
HBox(children=(FloatProgress(value=0.0, max=5.0), HTML(value='')))
images
{'https://i.redd.it/c14oontjoop21.png': 'math_skill.png', 'https://i.imgur.com/XJyemeI.jpg': 'great_success.jpg', 'https://miro.medium.com/max/700/0*b3jEIVWk_m0_J9jH.png': 'arrow_mem.png', 'https://i0.wp.com/nerdarchy.com/wp-content/uploads/2019/03/izzet-league.png': 'artificer.png'}