SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[feat] SXNG_Response: add method to parse html body (#6718)
Bnyro3169aafd2825
diff --git a/searx/extended_types.py b/searx/extended_types.pyindex 445ff0488..dc883b934 100644--- a/searx/extended_types.py+++ b/searx/extended_types.py@@ -29,6 +29,7 @@ from urllib.parse import urlsplitimport flaskfrom curl_cffi.requests import Response as CurlResponse+from lxml import htmlif typing.TYPE_CHECKING:import searx.preferences@@ -100,9 +101,14 @@ class SXNG_Response(CurlResponse):_url: str = ""@property- def url(self) -> SXNG_URL: # type: ignore[override]+ def url(self) -> SXNG_URL:return SXNG_URL(self._url)@url.setterdef url(self, value: str) -> None:self._url = str(value or "")++ def html(self) -> html.HtmlElement:+ """Parses the result into a HTML document via :py:obj:`lxml.html`."""++ return html.fromstring(self.text)