[feat] naver engine: add video embeds

This commit is contained in:
Austin-Olacsi 2025-08-31 05:58:42 -06:00 committed by Bnyro
parent 314924bc0e
commit 905b13aa7e

View File

@ -16,6 +16,7 @@ from searx.utils import (
html_to_text, html_to_text,
parse_duration_string, parse_duration_string,
js_variable_to_python, js_variable_to_python,
get_embeded_stream_url,
) )
# engine metadata # engine metadata
@ -185,6 +186,8 @@ def parse_videos(data):
dom = html.fromstring(data) dom = html.fromstring(data)
for item in eval_xpath_list(dom, "//li[contains(@class, 'video_item')]"): for item in eval_xpath_list(dom, "//li[contains(@class, 'video_item')]"):
url = eval_xpath_getindex(item, ".//a[contains(@class, 'info_title')]/@href", 0)
thumbnail = None thumbnail = None
try: try:
thumbnail = eval_xpath_getindex(item, ".//img[contains(@class, 'thumb')]/@src", 0) thumbnail = eval_xpath_getindex(item, ".//img[contains(@class, 'thumb')]/@src", 0)
@ -201,9 +204,10 @@ def parse_videos(data):
{ {
"template": "videos.html", "template": "videos.html",
"title": extract_text(eval_xpath(item, ".//a[contains(@class, 'info_title')]")), "title": extract_text(eval_xpath(item, ".//a[contains(@class, 'info_title')]")),
"url": eval_xpath_getindex(item, ".//a[contains(@class, 'info_title')]/@href", 0), "url": url,
"thumbnail": thumbnail, "thumbnail": thumbnail,
'length': length, "length": length,
"iframe_src": get_embeded_stream_url(url),
} }
) )