blob: 70758c1d9178bb48c8a46c21a66e784fd4b81150 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/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)
|