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] engine: add neocities.org
Austin-Olacsia6438586a5bf
diff --git a/searx/engines/neocities.py b/searx/engines/neocities.pynew file mode 100644index 000000000..0e0fcb33a--- /dev/null+++ b/searx/engines/neocities.py@@ -0,0 +1,66 @@+# SPDX-License-Identifier: AGPL-3.0-or-later+"""Neocities_ is open source software for creating blogs.++.. _Neocities : https://github.com/neocities/neocities+"""++from urllib.parse import urlencode+import typing as t++from lxml import html++from searx.utils import eval_xpath, eval_xpath_list, extract_text+from searx.result_types import EngineResults++if t.TYPE_CHECKING:+ from extended_types import SXNG_Response+ from search.processors import OnlineParams+++# Engine metadata+about = {+ "website": "https://neocities.org/",+ "wikidata_id": "Q17071099",+ "official_api_documentation": None,+ "use_official_api": False,+ "require_api_key": False,+ "results": "HTML",+}++# Engine configuration+categories = ["general", "blogs"]+paging = True++# Search URL+base_url = "https://neocities.org"++results_xpath = "//div[@class='result-item']"+url_xpath = './/div[@class="result-url"]/a/@href'+title_xpath = './/h3[@class="result-title"]/a/text()'+content_xpath = './/p[@class="result-snippet"]//text()'+screenshot_xpath = './/a[@class="result-screenshot"]/img/@src'+++def request(query: str, params: "OnlineParams") -> None:+ query_params: dict[str, t.Any] = {"q": query}+ if params['pageno'] > 1:+ offset = (params["pageno"] - 1) * 100+ query_params["start"] = offset+ params["url"] = f"{base_url}/search?{urlencode(query_params)}"+++def response(resp: "SXNG_Response") -> EngineResults:+ results = EngineResults()+ dom = html.fromstring(resp.text)++ for result in eval_xpath_list(dom, results_xpath):+ results.add(+ results.types.MainResult(+ url=extract_text(eval_xpath(result, url_xpath)),+ title=extract_text(eval_xpath(result, title_xpath)) or "",+ content=extract_text(eval_xpath(result, content_xpath)) or "",+ thumbnail=base_url + (extract_text(eval_xpath(result, screenshot_xpath)) or ""),+ )+ )++ return resultsdiff --git a/searx/settings.yml b/searx/settings.ymlindex d42b7e014..977b66852 100644--- a/searx/settings.yml+++ b/searx/settings.yml@@ -1697,6 +1697,12 @@ engines:shortcut: mwmdisabled: true+ - name: neocities+ engine: neocities+ shortcut: nc+ disabled: true+ inactive: true+- name: niconicoengine: niconicoshortcut: nico