mirror of
https://github.com/searxng/searxng.git
synced 2026-09-25 15:46:06 +00:00
[mod] migration of some engine results to the video class (#6743)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
committed by
Markus Heiser
parent
ce48993997
commit
2e41cf7407
@@ -7,10 +7,9 @@ results from Google.
|
||||
|
||||
import typing as t
|
||||
from urllib.parse import urlencode
|
||||
|
||||
import datetime
|
||||
from dateutil import parser
|
||||
|
||||
from searx.utils import format_duration
|
||||
from searx.result_types import EngineResults
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
@@ -49,7 +48,7 @@ def request(query: str, params: "OnlineParams") -> None:
|
||||
params["url"] = f"{api_url}/api/v2/search/{startpagina_categ}/?{urlencode(args)}"
|
||||
|
||||
|
||||
def response(resp: "SXNG_Response"):
|
||||
def response(resp: "SXNG_Response") -> EngineResults:
|
||||
res = EngineResults()
|
||||
|
||||
json_resp = resp.json()
|
||||
@@ -81,13 +80,12 @@ def response(resp: "SXNG_Response"):
|
||||
)
|
||||
elif startpagina_categ == "videos":
|
||||
res.add(
|
||||
res.types.LegacyResult(
|
||||
template="videos.html",
|
||||
res.types.Video(
|
||||
url=result["original_url"],
|
||||
title=result["title"],
|
||||
content=result["description"],
|
||||
thumbnail=result["video"]["thumbnail_url"],
|
||||
length=format_duration(result["video"]["duration"]),
|
||||
length=datetime.timedelta(seconds=result["video"]["duration"]),
|
||||
)
|
||||
)
|
||||
elif startpagina_categ == "images":
|
||||
|
||||
Reference in New Issue
Block a user