aboutsummaryrefslogtreecommitdiff
path: root/fetch-image
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-07-21 15:02:48 +0100
committerdiogo464 <[email protected]>2025-07-21 15:02:48 +0100
commit8c8dabd0ed20679a2dad43a5c239f9fcfe1c1ad7 (patch)
tree55abbcfbbff19efa3aaf6cf36540ac7651c54973 /fetch-image
init
Diffstat (limited to 'fetch-image')
-rwxr-xr-xfetch-image20
1 files changed, 20 insertions, 0 deletions
diff --git a/fetch-image b/fetch-image
new file mode 100755
index 000000000..70758c1d9
--- /dev/null
+++ b/fetch-image
@@ -0,0 +1,20 @@
1#!/usr/bin/env python3
2import os
3import sys
4import json
5import requests
6
7for slug in sys.argv[1:]:
8 data_path = os.path.join("events", slug, "data.json")
9 data = json.loads(open(data_path).read())
10 image_url = data["featured_image_src"]
11 image_path = os.path.join("events", slug, "image")
12 if os.path.exists(image_path):
13 continue
14 if image_url == "":
15 continue
16 response = requests.get(image_url)
17 response.raise_for_status()
18 with open(image_path, "wb") as f:
19 f.write(response.content)
20