mirror of
https://github.com/searxng/searxng.git
synced 2024-11-23 03:11:00 +00:00
include length in invidious results
This commit is contained in:
parent
0305fe0dd5
commit
2ed8ad7691
1 changed files with 7 additions and 2 deletions
|
@ -6,8 +6,7 @@
|
||||||
# @using-api yes
|
# @using-api yes
|
||||||
# @results JSON
|
# @results JSON
|
||||||
# @stable yes
|
# @stable yes
|
||||||
# @parse url, title, content, publishedDate, thumbnail, embedded
|
# @parse url, title, content, publishedDate, thumbnail, embedded, author, length
|
||||||
# @parse url, title, content, publishedDate, thumbnail, embedded, author
|
|
||||||
|
|
||||||
from searx.url_utils import quote_plus
|
from searx.url_utils import quote_plus
|
||||||
from dateutil import parser
|
from dateutil import parser
|
||||||
|
@ -85,12 +84,18 @@ def response(resp):
|
||||||
publishedDate = parser.parse(
|
publishedDate = parser.parse(
|
||||||
time.ctime(result.get("published", 0))
|
time.ctime(result.get("published", 0))
|
||||||
)
|
)
|
||||||
|
length = time.gmtime(result.get("lengthSeconds"))
|
||||||
|
if length.tm_hour:
|
||||||
|
length = time.strftime("%H:%M:%S", length)
|
||||||
|
else:
|
||||||
|
length = time.strftime("%M:%S", length)
|
||||||
|
|
||||||
results.append(
|
results.append(
|
||||||
{
|
{
|
||||||
"url": url,
|
"url": url,
|
||||||
"title": result.get("title", ""),
|
"title": result.get("title", ""),
|
||||||
"content": result.get("description", ""),
|
"content": result.get("description", ""),
|
||||||
|
'length': length,
|
||||||
"template": "videos.html",
|
"template": "videos.html",
|
||||||
"author": result.get("author"),
|
"author": result.get("author"),
|
||||||
"publishedDate": publishedDate,
|
"publishedDate": publishedDate,
|
||||||
|
|
Loading…
Reference in a new issue