aboutsummaryrefslogtreecommitdiff
path: root/extract-title
blob: 334ad9946dcdf7e622e34d4fc0b677d303c3a14e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python3
import os
import sys
import json
import html

for slug in sys.argv[1:]:
    data_path = os.path.join("events", slug, "data.json")
    title_path = os.path.join("events", slug, "title")
    with open(data_path, "r") as f:
        data = json.load(f)
    title = html.unescape(data["title"]["rendered"])
    if os.path.exists(title_path):
        continue
    with open(title_path, "w") as f:
        f.write(title)