diff options
| author | diogo464 <[email protected]> | 2025-07-24 17:03:18 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-07-24 17:03:18 +0100 |
| commit | 944d87cac0ac9f7098b0ee0f9132ce256eedd3b8 (patch) | |
| tree | e17da3fd8242621017fd6c2f9baa04f8e7371f72 /extract-title | |
| parent | 5c3fe9aac767ee44f271ea8d1086b28336c88334 (diff) | |
fix: run html.unescape on the title
some titles contains things like '–' so we run html.unescape to
remove them.
Diffstat (limited to 'extract-title')
| -rwxr-xr-x | extract-title | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/extract-title b/extract-title index 46b4d3630..334ad9946 100755 --- a/extract-title +++ b/extract-title | |||
| @@ -2,13 +2,14 @@ | |||
| 2 | import os | 2 | import os |
| 3 | import sys | 3 | import sys |
| 4 | import json | 4 | import json |
| 5 | import html | ||
| 5 | 6 | ||
| 6 | for slug in sys.argv[1:]: | 7 | for slug in sys.argv[1:]: |
| 7 | data_path = os.path.join("events", slug, "data.json") | 8 | data_path = os.path.join("events", slug, "data.json") |
| 8 | title_path = os.path.join("events", slug, "title") | 9 | title_path = os.path.join("events", slug, "title") |
| 9 | with open(data_path, "r") as f: | 10 | with open(data_path, "r") as f: |
| 10 | data = json.load(f) | 11 | data = json.load(f) |
| 11 | title = data["title"]["rendered"] | 12 | title = html.unescape(data["title"]["rendered"]) |
| 12 | if os.path.exists(title_path): | 13 | if os.path.exists(title_path): |
| 13 | continue | 14 | continue |
| 14 | with open(title_path, "w") as f: | 15 | with open(title_path, "w") as f: |
