on ea38fea help sign in
3 files changed+23−39
since splitsnapshots
unifiedsplit
Dockerfile+2−3 searx/engines/gigablast.py+13−24 searx/settings.yml+8−12
Dockerfile+2−3
@@ -51,14 +51,13 @@ RUN apk upgrade --no-cache \
5151 && apk del build-dependencies \
5252 && rm -rf /root/.cache
5353
54−COPY searx ./searx
55−COPY dockerfiles ./dockerfiles
54+COPY --chown=searx:searx . .
5655
5756ARG TIMESTAMP_SETTINGS=0
5857ARG TIMESTAMP_UWSGI=0
5958ARG VERSION_GITCOMMIT=unknown
6059
61−RUN /usr/bin/python3 -m compileall -q searx; \
60+RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
6261 touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml; \
6362 touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
6463 if [ ! -z $VERSION_GITCOMMIT ]; then\
searx/engines/gigablast.py+13−24
@@ -5,10 +5,10 @@
55# pylint: disable=missing-function-docstring, invalid-name
66
77import re
8−from json import loads, JSONDecodeError
8+from json import loads
99from urllib.parse import urlencode
10+# from searx import logger
1011from searx.network import get
11−from searx.exceptions import SearxEngineResponseException
1212
1313# about
1414about = {
@@ -22,9 +22,6 @@ about = {
2222
2323# engine dependent config
2424categories = ['general']
25−collections = 'main'
26−search_type = ''
27−fast = 0
2825# gigablast's pagination is totally damaged, don't use it
2926paging = False
3027safesearch = True
@@ -37,8 +34,6 @@ base_url = 'https://gigablast.com'
3734extra_param = ''
3835extra_param_path='/search?c=main&qlangcountry=en-us&q=south&s=10'
3936
40−_wait_for_results_msg = 'Loading results takes too long. Please enable fast option in gigablast engine.'
41−
4237def parse_extra_param(text):
4338
4439 # example:
@@ -59,6 +54,7 @@ def parse_extra_param(text):
5954 if re_var is not None and re_var.search(line):
6055 extra_param += re_var.search(line).group(1)
6156 break
57+ # logger.debug('gigablast extra_param="%s"', extra_param)
6258
6359def init(engine_settings=None): # pylint: disable=unused-argument
6460 parse_extra_param(get(base_url + extra_param_path).text)
@@ -69,17 +65,14 @@ def request(query, params): # pylint: disable=unused-argument
6965
7066 # see API http://www.gigablast.com/api.html#/search
7167 # Take into account, that the API has some quirks ..
72− query_args = {
73− 'c': collections,
74− 'format': 'json',
75− 'q': query,
76− 'dr': 1 ,
77− 'showgoodimages': 0,
78− 'fast': fast,
79− }
80−
81− if search_type != '':
82− query_args['searchtype'] = search_type
68+
69+ query_args = dict(
70+ c = 'main'
71+ , format = 'json'
72+ , q = query
73+ , dr = 1
74+ , showgoodimages = 0
75+ )
8376
8477 if params['language'] and params['language'] != 'all':
8578 query_args['qlangcountry'] = params['language']
@@ -97,13 +90,9 @@ def request(query, params): # pylint: disable=unused-argument
9790def response(resp):
9891 results = []
9992
100− try:
101− response_json = loads(resp.text)
102− except JSONDecodeError as e:
103− if 'Waiting for results' in resp.text:
104− raise SearxEngineResponseException(message=_wait_for_results_msg) # pylint: disable=raise-missing-from
105− raise e
93+ response_json = loads(resp.text)
10694
95+ # logger.debug('gigablast returns %s results', len(response_json['results']))
10796
10897 for result in response_json['results']:
10998 # see "Example JSON Output (&format=json)"
searx/settings.yml+8−12
@@ -505,13 +505,6 @@ engines:
505505 engine : gigablast
506506 shortcut : gb
507507 timeout : 3.0
508− # Collection names to search in, separated by whitespaces.
509− # By default searx, queries the main collection.
510− #collections: main
511− # Search types, not required. possible values: images, news
512− #search_type: images
513− # Enable fast to get results quicker.
514− #fast : 1
515508 disabled: True
516509 additional_tests:
517510 rosebud: *test_rosebud
@@ -697,19 +690,22 @@ engines:
697690
698691 - name : hoogle
699692 engine : xpath
693+ paging : True
700694 search_url : https://hoogle.haskell.org/?hoogle={query}&start={pageno}
701695 results_xpath : '//div[@class="result"]'
702− title_xpath : './div[@class="ans"]'
703− url_xpath : './div[@class="ans"]//a/@href'
704− content_xpath : './div[contains(@class, "doc")]'
696+ title_xpath : './/div[@class="ans"]//a'
697+ url_xpath : './/div[@class="ans"]//a/@href'
698+ content_xpath : './/div[@class="from"]'
699+ page_size : 20
705700 categories : it
706701 shortcut : ho
707702 about:
708− website: https://hoogle.haskell.org/
703+ website: https://www.haskell.org/
709704 wikidata_id: Q34010
705+ official_api_documentation: https://hackage.haskell.org/api
710706 use_official_api: false
711707 require_api_key: false
712− results: HTML
708+ results: JSON
713709
714710 - name : imdb
715711 engine : imdb