Sanitize values from Odysee a little bit

They offer some basic sanitization, but we need to apparently strip whitespace, because that's not something they do
This commit is contained in:
Salt 2025-01-24 14:33:51 -06:00
parent c925aea731
commit f9786ddb64

View File

@ -49,11 +49,13 @@ def odysee_get_releases(handle):
if not item["value"].get("source", {}).get("hash"):
continue
releases[item["claim_id"]] = {
"name": item.get("name", "Unnamed Release"),
"title": item["value"].get("title", "Untitled Release"),
# Fields with .strip() at the end are user-controlled and may mess with sorting if
# leading/trailing whitespace is left in.
"name": item.get("name", "Unnamed Release").strip(),
"title": item["value"].get("title", "Untitled Release").strip(),
# This field is an int in unixtime
"publishdate": int(item["value"].get("release_time", 0)),
"description": item["value"].get("description", "No description provided for this release"),
"description": item["value"].get("description", "No description provided for this release").strip(),
"thumbnail": item["value"].get("thumbnail", {}).get("url", ""),
"url": f"{odysee_get_channel_url(handle)}/{item['name']}",
"filehash": item["value"].get("source", {}).get("hash", "")