1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

[mod] piped: always show video length if available

This commit is contained in:
Bnyro 2023-10-07 10:57:47 +02:00 committed by Markus Heiser
parent ce270961e8
commit f22daf8b47

View File

@ -140,6 +140,9 @@ def response(resp):
"publishedDate": parser.parse(time.ctime(uploaded / 1000)) if uploaded != -1 else None, "publishedDate": parser.parse(time.ctime(uploaded / 1000)) if uploaded != -1 else None,
"iframe_src": _frontend_url() + '/embed' + result.get("url", ""), "iframe_src": _frontend_url() + '/embed' + result.get("url", ""),
} }
length = result.get("duration")
if length:
item["length"] = datetime.timedelta(seconds=length)
if piped_filter == 'videos': if piped_filter == 'videos':
item["template"] = "videos.html" item["template"] = "videos.html"
@ -151,9 +154,6 @@ def response(resp):
item["template"] = "default.html" item["template"] = "default.html"
item["img_src"] = result.get("thumbnail", "") item["img_src"] = result.get("thumbnail", "")
item["content"] = result.get("uploaderName", "") or "" item["content"] = result.get("uploaderName", "") or ""
length = result.get("duration")
if length:
item["length"] = datetime.timedelta(seconds=length)
results.append(item) results.append(item)