summaryrefslogtreecommitdiff
path: root/searx/engines/yacy.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2023-08-03 19:52:52 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-08-03 19:58:51 +0200
commit1b030d4b4192db0aae4f3c299c047dd136ab15bb (patch)
tree1a2c118566e7724a148d13fea5a7e4afdfd81791 /searx/engines/yacy.py
parentca518c68035ffa60825eedd3ef4cfb404605c78c (diff)
downloadsearxng-1b030d4b4192db0aae4f3c299c047dd136ab15bb.tar.gz
searxng-1b030d4b4192db0aae4f3c299c047dd136ab15bb.zip
[doc] engine: Yacy
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/yacy.py')
-rw-r--r--searx/engines/yacy.py51
1 files changed, 45 insertions, 6 deletions
diff --git a/searx/engines/yacy.py b/searx/engines/yacy.py
index 7283b7554..0603a4564 100644
--- a/searx/engines/yacy.py
+++ b/searx/engines/yacy.py
@@ -1,11 +1,44 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
+# lint: pylint
+"""YaCy_ is a free distributed search engine, built on the principles of
+peer-to-peer (P2P) networks.
+
+API: Dev:APIyacysearch_
+
+Releases:
+
+- https://github.com/yacy/yacy_search_server/tags
+- https://download.yacy.net/
+
+.. _Yacy: https://yacy.net/
+.. _Dev:APIyacysearch: https://wiki.yacy.net/index.php/Dev:APIyacysearch
+
+Configuration
+=============
+
+The engine has the following (additional) settings:
+
+.. code:: yaml
+
+ - name: yacy
+ engine: yacy
+ shortcut: ya
+ base_url: http://localhost:8090
+ # Yacy search mode. 'global' or 'local'.
+ search_mode: 'global'
+ number_of_results: 5
+ http_digest_auth_user: ""
+ http_digest_auth_pass: ""
+
+
+Implementations
+===============
"""
- Yacy (Web, Images, Videos, Music, Files)
-"""
+# pylint: disable=fixme
from json import loads
-from dateutil import parser
from urllib.parse import urlencode
+from dateutil import parser
from httpx import DigestAuth
@@ -27,8 +60,16 @@ paging = True
number_of_results = 5
http_digest_auth_user = ""
http_digest_auth_pass = ""
-search_mode = 'global' # 'global', 'local'. By default, in yacy this is 'global'.
+search_mode = 'global'
+"""Yacy search mode ``global`` or ``local``. By default, Yacy operates in ``global``
+mode.
+
+``global``
+ Peer-to-Peer search
+``local``
+ Privacy or Stealth mode, restricts the search to local yacy instance.
+"""
# search-url
base_url = 'http://localhost:8090'
search_url = (
@@ -43,7 +84,6 @@ search_url = (
search_types = {'general': 'text', 'images': 'image', 'files': 'app', 'music': 'audio', 'videos': 'video'}
-# do search-request
def request(query, params):
offset = (params['pageno'] - 1) * number_of_results
search_type = search_types.get(params.get('category'), '0')
@@ -66,7 +106,6 @@ def request(query, params):
return params
-# get response from search-request
def response(resp):
results = []