76def response(resp):
77 data = resp.json()
78 results = []
79
80 for item in data:
81 name = item["name"]
82 claim_id = item["claimId"]
83 title = item["title"]
84 thumbnail_url = item["thumbnail_url"]
85 description = item["description"] or ""
86 channel = item["channel"]
87 release_time = item["release_time"]
88 duration = item["duration"]
89
90 release_date = datetime.strptime(release_time.split("T")[0], "%Y-%m-%d")
91 formatted_date = datetime.utcfromtimestamp(release_date.timestamp())
92
93 url = f"https://odysee.com/{name}:{claim_id}"
94 iframe_url = f"https://odysee.com/$/embed/{name}:{claim_id}"
95 odysee_thumbnail = f"https://thumbnails.odycdn.com/optimize/s:390:0/quality:85/plain/{thumbnail_url}"
96 formatted_duration = format_duration(duration)
97
98 results.append(
99 {
100 "title": title,
101 "url": url,
102 "content": description,
103 "author": channel,
104 "publishedDate": formatted_date,
105 "length": formatted_duration,
106 "thumbnail": odysee_thumbnail,
107 "iframe_src": iframe_url,
108 "template": "videos.html",
109 }
110 )
111
112 return results
113
114