[tenor] fix 'title' metadata
remove the trailing 4 characters only when they are ' GIF'
This commit is contained in:
@@ -40,13 +40,14 @@ class TenorExtractor(Extractor):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
url = fmt["url"]
|
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["id_format"] = url.rsplit("/", 2)[1]
|
||||||
gif["format"] = fmt["name"]
|
gif["format"] = fmt["name"]
|
||||||
gif["width"], gif["height"] = fmt["dims"]
|
|
||||||
gif["duration"] = fmt["duration"]
|
gif["duration"] = fmt["duration"]
|
||||||
gif["size"] = fmt["size"]
|
gif["size"] = fmt["size"]
|
||||||
gif["title"] = gif["h1_title"][:-4]
|
|
||||||
gif["description"] = gif.pop("content_description", "")
|
|
||||||
gif["date"] = self.parse_timestamp(gif["created"])
|
gif["date"] = self.parse_timestamp(gif["created"])
|
||||||
|
|
||||||
yield Message.Directory, "", gif
|
yield Message.Directory, "", gif
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ __tests__ = (
|
|||||||
"embed" : r"re:<div class=.+",
|
"embed" : r"re:<div class=.+",
|
||||||
"extension": "gif",
|
"extension": "gif",
|
||||||
"filename" : "moving",
|
"filename" : "moving",
|
||||||
"h1_title" : "Moving Sticker",
|
"!h1_title": "Moving Sticker",
|
||||||
"hasaudio" : False,
|
"hasaudio" : False,
|
||||||
"format" : "gif",
|
"format" : "gif",
|
||||||
"width" : 467,
|
"width" : 467,
|
||||||
@@ -34,9 +34,9 @@ __tests__ = (
|
|||||||
"long_title": "Moving Sticker - Moving Stickers",
|
"long_title": "Moving Sticker - Moving Stickers",
|
||||||
"media_formats": dict,
|
"media_formats": dict,
|
||||||
"policy_status": "POLICY_STATUS_UNSPECIFIED",
|
"policy_status": "POLICY_STATUS_UNSPECIFIED",
|
||||||
"shares" : range(40000, 60000),
|
"shares" : range(70_000, 200_000),
|
||||||
"source_id": "",
|
"source_id": "",
|
||||||
"title" : "Moving Sti",
|
"title" : "Moving Sticker",
|
||||||
"url" : "https://tenor.com/kjYh53rdMGt.gif",
|
"url" : "https://tenor.com/kjYh53rdMGt.gif",
|
||||||
"flags" : [
|
"flags" : [
|
||||||
"static",
|
"static",
|
||||||
@@ -94,6 +94,66 @@ __tests__ = (
|
|||||||
"#class": tenor.TenorImageExtractor,
|
"#class": tenor.TenorImageExtractor,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://tenor.com/view/dance-dancing-rhythm-music-party-gif-10174070686436479501",
|
||||||
|
"#class" : tenor.TenorImageExtractor,
|
||||||
|
"#results" : "https://media1.tenor.com/m/jTGPYoDC0g0AAAAC/dance-dancing.gif",
|
||||||
|
|
||||||
|
"bg_color" : "",
|
||||||
|
"created" : 1761968378.53755,
|
||||||
|
"date" : "dt:2025-11-01 03:39:38",
|
||||||
|
"description" : "a blue and white penguin with the word pengu written below it",
|
||||||
|
"duration" : 1.4,
|
||||||
|
"embed" : """<div class="tenor-gif-embed" data-postid="10174070686436479501" data-share-method="host" data-aspect-ratio="1" data-width="100%"><a href="https://tenor.com/view/dance-dancing-rhythm-music-party-gif-10174070686436479501">Dance Dancing Sticker</a>from <a href="https://tenor.com/search/dance-stickers">Dance Stickers</a></div> <script type="text/javascript" async src="https://tenor.com/embed.js"></script>""",
|
||||||
|
"extension" : "gif",
|
||||||
|
"filename" : "dance-dancing",
|
||||||
|
"flags" : ["sticker"],
|
||||||
|
"format" : "gif",
|
||||||
|
"hasaudio" : False,
|
||||||
|
"height" : 498,
|
||||||
|
"id" : "10174070686436479501",
|
||||||
|
"id_format" : "jTGPYoDC0g0AAAAC",
|
||||||
|
"index" : 0,
|
||||||
|
"itemurl" : "https://tenor.com/view/dance-dancing-rhythm-music-party-gif-10174070686436479501",
|
||||||
|
"legacy_info" : {"post_id": "0"},
|
||||||
|
"long_title" : "Dance Dancing Sticker - Dance Dancing Rhythm Stickers",
|
||||||
|
"policy_status": "POLICY_STATUS_UNSPECIFIED",
|
||||||
|
"shares" : range(20_000, 200_000),
|
||||||
|
"size" : 379845,
|
||||||
|
"source_id" : "",
|
||||||
|
"title" : "Dance Dancing Sticker",
|
||||||
|
"url" : "https://tenor.com/mhJvX13UBsL.gif",
|
||||||
|
"width" : 498,
|
||||||
|
"media_formats": dict,
|
||||||
|
"tags" : [
|
||||||
|
"dance",
|
||||||
|
"dancing",
|
||||||
|
"rhythm",
|
||||||
|
"music",
|
||||||
|
"party",
|
||||||
|
"happy",
|
||||||
|
"meme",
|
||||||
|
"funny",
|
||||||
|
"dancer",
|
||||||
|
"cute",
|
||||||
|
"excited",
|
||||||
|
"pengu",
|
||||||
|
"pudgy",
|
||||||
|
"penguin",
|
||||||
|
"pudgypenguins",
|
||||||
|
],
|
||||||
|
"user" : {
|
||||||
|
"flags" : ["partner"],
|
||||||
|
"partnername" : "Pudgy Penguins",
|
||||||
|
"profile_id" : "7220590138123212970",
|
||||||
|
"tagline" : "Pudgy Penguins supplying the internet with good vibes",
|
||||||
|
"url" : "https://tenor.com/official/PudgyPenguins",
|
||||||
|
"userid" : "12680456",
|
||||||
|
"username" : "PudgyPenguins",
|
||||||
|
"usertype" : "partner",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://tenor.com/search/trees-gifs",
|
"#url" : "https://tenor.com/search/trees-gifs",
|
||||||
"#class" : tenor.TenorSearchExtractor,
|
"#class" : tenor.TenorSearchExtractor,
|
||||||
|
|||||||
Reference in New Issue
Block a user