[tenor] fix 'title' metadata

remove the trailing 4 characters only when they are ' GIF'
This commit is contained in:
Mike Fährmann
2025-12-16 10:15:46 +01:00
parent 3536816d51
commit 7804f70f02
2 changed files with 67 additions and 6 deletions

View File

@@ -40,13 +40,14 @@ class TenorExtractor(Extractor):
continue
url = fmt["url"]
title = gif.pop("h1_title", "")
gif["title"] = title[:-4] if title.endswith(" GIF") else title
gif["width"], gif["height"] = fmt.pop("dims") or (0, 0)
gif["description"] = gif.pop("content_description", "")
gif["id_format"] = url.rsplit("/", 2)[1]
gif["format"] = fmt["name"]
gif["width"], gif["height"] = fmt["dims"]
gif["duration"] = fmt["duration"]
gif["size"] = fmt["size"]
gif["title"] = gif["h1_title"][:-4]
gif["description"] = gif.pop("content_description", "")
gif["date"] = self.parse_timestamp(gif["created"])
yield Message.Directory, "", gif