diff options
author | Adam Tauber <asciimoo@gmail.com> | 2020-08-10 12:49:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-10 12:49:17 +0200 |
commit | 77103c78740169768a41587f852c73d8772c49e6 (patch) | |
tree | 49a37db54c82a47814610f61619897c1fb58cb6f /searx | |
parent | e6d002a7303fb6ffd7d18564360603bcac5f2480 (diff) | |
parent | 2ed8ad76917ec9429763d8cd5c22d20303673ca0 (diff) | |
download | searxng-77103c78740169768a41587f852c73d8772c49e6.tar.gz searxng-77103c78740169768a41587f852c73d8772c49e6.zip |
Merge pull request #2116 from mikeri/invidiousres
Include author and video length in Invidious results
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/invidious.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/searx/engines/invidious.py b/searx/engines/invidious.py index 8d81691fc..cf76fd215 100644 --- a/searx/engines/invidious.py +++ b/searx/engines/invidious.py @@ -6,7 +6,7 @@ # @using-api yes # @results JSON # @stable yes -# @parse url, title, content, publishedDate, thumbnail, embedded +# @parse url, title, content, publishedDate, thumbnail, embedded, author, length from searx.url_utils import quote_plus from dateutil import parser @@ -84,13 +84,20 @@ 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, "embedded": embedded, "thumbnail": thumbnail, |