mirror of
https://github.com/searxng/searxng.git
synced 2026-09-23 06:36:12 +00:00
[mod] typification of SearXNG: add new result type Video (#6743)
- Python class: searx/result_types/video.py - Jinja template: searx/templates/simple/result_templates/videos.html - CSS (less) client/simple/src/less/result_types/video.less Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
committed by
Markus Heiser
parent
fdd8525b1a
commit
e40de2d992
@@ -593,13 +593,24 @@ def eval_xpath_getindex(
|
||||
return default
|
||||
|
||||
|
||||
def get_embedded_stream_url(url: str):
|
||||
"""
|
||||
Converts a standard video URL into its embed format. Supported services include Youtube,
|
||||
Facebook, Instagram, TikTok, Dailymotion, and Bilibili.
|
||||
def get_embedded_stream_url(url: str) -> str:
|
||||
"""Converts a standard video URL into its embed format.
|
||||
|
||||
Supported services include:
|
||||
|
||||
- Youtube
|
||||
- Facebook
|
||||
- Instagram
|
||||
- TikTok
|
||||
- Dailymotion
|
||||
- Bilibili
|
||||
|
||||
The function is suitable for the field :obj:`MainResult.iframe_src
|
||||
<searx.result_types.MainResult.iframe_src>`. If ``url`` is not from one of
|
||||
the supported services, an empty string is returned.
|
||||
"""
|
||||
parsed_url = urlparse(url)
|
||||
iframe_src = None
|
||||
iframe_src = ""
|
||||
|
||||
# YouTube
|
||||
if parsed_url.netloc in ['www.youtube.com', 'youtube.com'] and parsed_url.path == '/watch' and parsed_url.query:
|
||||
|
||||
Reference in New Issue
Block a user