#!/usr/bin/env python3 import os import sys import json import requests for slug in sys.argv[1:]: data_path = os.path.join("events", slug, "data.json") data = json.loads(open(data_path).read()) image_url = data["featured_image_src"] image_path = os.path.join("events", slug, "image") if os.path.exists(image_path): continue if image_url == "": continue response = requests.get(image_url) response.raise_for_status() with open(image_path, "wb") as f: f.write(response.content)