From 0305fe0dd5a5aaad5965e87e80c6cc5a2ce0e17f Mon Sep 17 00:00:00 2001 From: Michael Ilsaas Date: Sun, 2 Aug 2020 13:30:38 +0200 Subject: [PATCH 1/2] include author in invidious results --- searx/engines/invidious.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/searx/engines/invidious.py b/searx/engines/invidious.py index 8d81691fc..e94d7c17d 100644 --- a/searx/engines/invidious.py +++ b/searx/engines/invidious.py @@ -7,6 +7,7 @@ # @results JSON # @stable yes # @parse url, title, content, publishedDate, thumbnail, embedded +# @parse url, title, content, publishedDate, thumbnail, embedded, author from searx.url_utils import quote_plus from dateutil import parser @@ -91,6 +92,7 @@ def response(resp): "title": result.get("title", ""), "content": result.get("description", ""), "template": "videos.html", + "author": result.get("author"), "publishedDate": publishedDate, "embedded": embedded, "thumbnail": thumbnail, From 2ed8ad76917ec9429763d8cd5c22d20303673ca0 Mon Sep 17 00:00:00 2001 From: Michael Ilsaas Date: Sun, 2 Aug 2020 13:31:04 +0200 Subject: [PATCH 2/2] include length in invidious results --- searx/engines/invidious.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/searx/engines/invidious.py b/searx/engines/invidious.py index e94d7c17d..cf76fd215 100644 --- a/searx/engines/invidious.py +++ b/searx/engines/invidious.py @@ -6,8 +6,7 @@ # @using-api yes # @results JSON # @stable yes -# @parse url, title, content, publishedDate, thumbnail, embedded -# @parse url, title, content, publishedDate, thumbnail, embedded, author +# @parse url, title, content, publishedDate, thumbnail, embedded, author, length from searx.url_utils import quote_plus from dateutil import parser @@ -85,12 +84,18 @@ def response(resp): publishedDate = parser.parse( 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( { "url": url, "title": result.get("title", ""), "content": result.get("description", ""), + 'length': length, "template": "videos.html", "author": result.get("author"), "publishedDate": publishedDate,