on master help sign in
Merge pull request #2116 from mikeri/invidiousres
77103c7Adam Tauber
searx/engines/invidious.py+8−1
@@ -6,7 +6,7 @@
6# @using-api yes
6# @using-api yes
7# @results JSON
7# @results JSON
8# @stable yes
8# @stable yes
9−# @parse url, title, content, publishedDate, thumbnail, embedded
9+# @parse url, title, content, publishedDate, thumbnail, embedded, author, length
10
10
11from searx.url_utils import quote_plus
11from searx.url_utils import quote_plus
12from dateutil import parser
12from dateutil import parser
@@ -84,13 +84,20 @@ def response(resp):
84 publishedDate = parser.parse(
84 publishedDate = parser.parse(
85 time.ctime(result.get("published", 0))
85 time.ctime(result.get("published", 0))
86 )
86 )
87+ length = time.gmtime(result.get("lengthSeconds"))
88+ if length.tm_hour:
89+ length = time.strftime("%H:%M:%S", length)
90+ else:
91+ length = time.strftime("%M:%S", length)
87
92
88 results.append(
93 results.append(
89 {
94 {
90 "url": url,
95 "url": url,
91 "title": result.get("title", ""),
96 "title": result.get("title", ""),
92 "content": result.get("description", ""),
97 "content": result.get("description", ""),
98+ 'length': length,
93 "template": "videos.html",
99 "template": "videos.html",
100+ "author": result.get("author"),
94 "publishedDate": publishedDate,
101 "publishedDate": publishedDate,
95 "embedded": embedded,
102 "embedded": embedded,
96 "thumbnail": thumbnail,
103 "thumbnail": thumbnail,