scripts/init-feed: sanitize titles/descriptions

This commit is contained in:
2024-08-16 02:39:56 +00:00
parent f603bad779
commit 5dcb7b5cf6

View File

@@ -19,7 +19,7 @@ def try_scheme(url: str, scheme: str):
def clean_item(item: dict) -> dict:
''' remove keys/values i don't care to keep in git '''
return {
item = {
k:v for k,v in item.items() if k in [
# "content_type",
"description", # not used
@@ -38,6 +38,11 @@ def clean_item(item: dict) -> dict:
# "version",
]
}
# clean up characters for better printability
for k in "title", "site_name", "description":
if k not in item: continue
item[k] = item[k].replace("\u2013", "-")
return item
def try_load_existing_feed(path_: str) -> dict:
try: