summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorjazzzooo <38244149+jazzzooo@users.noreply.github.com>2023-09-13 05:36:41 +0000
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-09-13 11:37:42 +0200
commit6039dbf2112d8bd78dba189562a19a92d04f7907 (patch)
treee663566f1f431f0259666ee883b53ff3bfeee10f /searx
parented3819bdd5b8d8e24eb1d973314ad5054e4de81e (diff)
downloadsearxng-6039dbf2112d8bd78dba189562a19a92d04f7907.tar.gz
searxng-6039dbf2112d8bd78dba189562a19a92d04f7907.zip
[fix] engine - invidious thumbnails
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/invidious.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/searx/engines/invidious.py b/searx/engines/invidious.py
index 29f276636..566b0cf98 100644
--- a/searx/engines/invidious.py
+++ b/searx/engines/invidious.py
@@ -5,7 +5,7 @@
import time
import random
-from urllib.parse import quote_plus
+from urllib.parse import quote_plus, urlparse
from dateutil import parser
# about
@@ -75,6 +75,11 @@ def response(resp):
else:
thumbnail = ""
+ # some instances return a partial thumbnail url
+ # we check if the url is partial, and prepend the base_url if it is
+ if thumbnail and not urlparse(thumbnail).netloc:
+ thumbnail = resp.search_params['base_url'] + thumbnail
+
publishedDate = parser.parse(time.ctime(result.get("published", 0)))
length = time.gmtime(result.get("lengthSeconds"))
if length.tm_hour: