summaryrefslogtreecommitdiff
path: root/searx/engines/youtube_api.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2022-02-07 16:16:57 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2022-02-13 14:20:47 +0100
commit46e131fdadd94910c0e258aa4e855ad8019edbf7 (patch)
tree3e4de6dae4274331631bfefb3e3446e13bc9c022 /searx/engines/youtube_api.py
parenta4942213a1dc6404616e239e0d2fb55a6e19a499 (diff)
[mod] result_templates/videos.html: replace embedded HTML by data_src
Embedded HTML breaks SearXNG architecture. To modularize, HTML is generated in the templates (oscar & simple) and result parameter 'embedded' is replaced by 'data_src', an URL for embedded content (<iframe>). Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/youtube_api.py')
-rw-r--r--searx/engines/youtube_api.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/searx/engines/youtube_api.py b/searx/engines/youtube_api.py
index 52db45960..6c46ca90c 100644
--- a/searx/engines/youtube_api.py
+++ b/searx/engines/youtube_api.py
@@ -26,13 +26,6 @@ api_key = None
# search-url
base_url = 'https://www.googleapis.com/youtube/v3/search'
search_url = base_url + '?part=snippet&{query}&maxResults=20&key={api_key}'
-
-embedded_url = (
- '<iframe width="540" height="304" '
- + 'data-src="https://www.youtube-nocookie.com/embed/{videoid}" '
- + 'frameborder="0" allowfullscreen></iframe>'
-)
-
base_youtube_url = 'https://www.youtube.com/watch?v='
@@ -77,8 +70,6 @@ def response(resp):
url = base_youtube_url + videoid
- embedded = embedded_url.format(videoid=videoid)
-
# append result
results.append(
{
@@ -87,7 +78,7 @@ def response(resp):
'content': content,
'template': 'videos.html',
'publishedDate': publishedDate,
- 'embedded': embedded,
+ 'data_src': "https://www.youtube-nocookie.com/embed/" + videoid,
'thumbnail': thumbnail,
}
)