Commit Graph

4402 Commits

Author SHA1 Message Date
Markus Heiser 98a63058e5 [fix] google answers: normalize space of the answers.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-03 16:53:31 +02:00
Markus Heiser 412677d495 [mod] google engine: reduce mobile UI parameters to what is needed
Reverse engineering shows that not all of the parameters used by google's mobile
UI (aka "more results" button) are needed [1].

[1] https://github.com/searxng/searxng/pull/160#issuecomment-865013625

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-03 16:53:31 +02:00
Alexandre Flament 8bf216eab6 [mod] google: add "use_mobile_ui" parameter to use mobile endpoint.
disable by default, it has to be enabled in settings.yml

related to  #159
2021-07-03 16:53:31 +02:00
Alexandre Flament 3863f5a83f [enh] google engine: supports "default language"
Same behaviour behaviour than Whoogle [1].  Only the google engine with the
"Default language" choice "(all)"" is changed by this patch.

When searching for a locate place, the result are in the expect language,
without missing results [2]:

  > When a language is not specified, the language interpretation is left up to
  > Google to decide how the search results should be delivered.

The query parameters are copied from Whoogle.  With the ``all`` language:

- add parameter ``source=lnt``
- don't use parameter ``lr``
- don't add a ``Accept-Language`` HTTP header.

The new signature of function ``get_lang_info()`` is:

    lang_info = get_lang_info(params, lang_list, custom_aliases, supported_any_language)

Argument ``supported_any_language`` is True for google.py and False for the other
google engines.  With this patch the function now returns:

- query parameters: ``lang_info['params']``
- HTTP headers: ``lang_info['headers']``
- and as before this patch:
  - ``lang_info['subdomain']``
  - ``lang_info['country']``
  - ``lang_info['language']``

[1] https://github.com/benbusby/whoogle-search
[2] https://github.com/benbusby/whoogle-search/releases/tag/v0.5.4
2021-07-03 16:53:31 +02:00
dependabot[bot] e628d75727 Bump httpx[http2] from 0.17.1 to 0.18.2
Bumps [httpx[http2]](https://github.com/encode/httpx) from 0.17.1 to 0.18.2.
- [Release notes](https://github.com/encode/httpx/releases)
- [Changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/encode/httpx/compare/0.17.1...0.18.2)

---
updated-dependencies:
- dependency-name: httpx[http2]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-03 15:45:33 +02:00
dependabot[bot] 75e85f2a38 Bump sphinx-tabs from 2.1.0 to 3.1.0
Bumps [sphinx-tabs](https://github.com/executablebooks/sphinx-tabs) from 2.1.0 to 3.1.0.
- [Release notes](https://github.com/executablebooks/sphinx-tabs/releases)
- [Changelog](https://github.com/executablebooks/sphinx-tabs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/executablebooks/sphinx-tabs/compare/v2.1.0...v3.1.0)

---
updated-dependencies:
- dependency-name: sphinx-tabs
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-03 15:37:10 +02:00
dalf 66206bfb36 Update searx.data - update_ahmia_blacklist.py 2021-07-03 15:31:09 +02:00
dalf 5bfcc120ba Update searx.data - update_wikidata_units.py 2021-07-03 15:21:20 +02:00
dalf 5c57f83ac6 Update searx.data - update_currencies.py 2021-07-03 15:21:01 +02:00
Noémi Ványi c5d63a5c97
Merge pull request #2837 from searx/update_data_update_currencies.py
Update searx.data - update_currencies.py
2021-06-03 22:17:29 +02:00
dalf 9e7a68480c Update searx.data - update_currencies.py 2021-06-03 22:13:13 +02:00
Noémi Ványi 2db2dfa874
Merge pull request #2836 from searx/update_data_update_wikidata_units.py
Update searx.data - update_wikidata_units.py
2021-06-03 22:12:38 +02:00
dalf 89acf2462a Update searx.data - update_wikidata_units.py 2021-06-03 22:03:36 +02:00
Noémi Ványi 0d10ad5602
Merge pull request #2835 from searx/update_data_update_firefox_version.py
Update searx.data - update_firefox_version.py
2021-06-03 21:56:31 +02:00
dalf 3033b3297f Update searx.data - update_firefox_version.py 2021-06-03 21:48:45 +02:00
Noémi Ványi 6b738021f7
Merge pull request #2834 from searx/update_data_update_ahmia_blacklist.py
Update searx.data - update_ahmia_blacklist.py
2021-06-03 21:48:08 +02:00
dalf fc5973cf95 Update searx.data - update_ahmia_blacklist.py 2021-06-03 21:44:22 +02:00
Noémi Ványi d89b42879b
Merge pull request #2829 from jordemort/mankier
Add json_engine configuration for ManKier
2021-06-03 21:40:37 +02:00
Jordan Webb 60ad4118d6
Add json_engine configuration for ManKier 2021-05-31 13:54:50 -05:00
Noémi Ványi 0267563970
Merge pull request #2830 from jordemort/pypi
Add xpath configuration for PyPI
2021-05-31 20:36:43 +02:00
Adam Tauber c8d2b5eb34 [doc] add info about redis engine dependency 2021-05-30 19:25:26 +02:00
Adam Tauber 01a8a5814a [fix] pylint 2021-05-30 19:25:03 +02:00
Adam Tauber ea7ccf2422 [fix] correct kv template formatting and remove internal data 2021-05-30 19:20:46 +02:00
Adam Tauber 97269be680 [enh] add redis offline engine 2021-05-30 19:20:17 +02:00
Jordan Webb 66d06b05fe
Add xpath configuration for PyPI 2021-05-28 16:32:32 -05:00
Noémi Ványi 22a79a4896 Add blog post about SQL servers 2021-05-27 10:29:07 +02:00
Allen 28e4ef9173
Adds Dogpile as an engine (#2822)
* Add Dogpile engine

Example Query:
[https://www.dogpile.com/serp?q=streisand+effect](https://www.dogpile.com/serp?q=streisand+effect)

* Remove double "engines: " text
2021-05-26 23:39:32 +02:00
Noémi Ványi c486adf8f7 Minor fixes to wikimini engine 2021-05-26 23:34:25 +02:00
LL Productions FR bed044cc62 Add Wikimini
Fixed a mistake

Update settings.yml

Squashed 3 commits that is for adding Wikimini to Searx
2021-05-22 21:38:00 +02:00
Markus Heiser 0647b34b1d [fix] engine archive is - search_url has been changed
BTW: set soft_max_redirects from *archive is* by 1, to prevent logging::

    DEBUG:httpx._client:HTTP Request: GET https://archive.is/search/?q=www.python.org "HTTP/2 302 Found"
    DEBUG:httpx._client:HTTP Request: GET https://archive.is/www.python.org "HTTP/2 200 OK"
    DEBUG:searx:archive is: ErrorContext('searx/search/processors/online.py', 110, 'count_error(self.engine_name,', None, '1 redirects, maximum: 0', ('200', 'OK', 'archive.is')) True

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-05-22 20:42:24 +02:00
Markus Heiser 650a1c0b89 [enh] xpath engine - add request parameter 'soft_max_redirects'
Make 'soft_max_redirects' configurable per Xpath engine::

    - name : <engine-name>
      engine : xpath
      soft_max_redirects: 1
      ...

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-05-22 20:41:36 +02:00
Noémi Ványi cafd4cb4f8 Follow up /stats changes in unit test 2021-05-15 21:29:04 +02:00
Adam Tauber 9b5415ea2f [mod] disable /stats page by default to prevent potential data leak 2021-05-13 22:21:46 +02:00
Adam Tauber 6cd3bf376f [fix] activate pylint only for the tests 2021-05-13 22:14:55 +02:00
Noémi Ványi 0313797dfd Add sqlite engine to pylint 2021-05-13 21:47:38 +02:00
Noémi Ványi 8e90a214ce Add sqlite engine
Closes #2808
2021-05-13 21:40:25 +02:00
Noémi Ványi 0627fab511
Merge pull request #2807 from kvch/fix-master-failure
Cherry-pick initialization fixes to make master stable
2021-05-10 21:23:29 +02:00
Alexandre Flament 4a187d41be [fix] fix KeyError: 'ipv6'
tests/units/network/test_network.py requires a call to searx.network.network.initialize
Depending of the test order execution, this function was sometimes call in another test,
sometimes not.

This commit ensure there is a call to initialize()
2021-05-10 21:17:00 +02:00
Alexandre Flament 5e53e9412d [mod] searx.network.client: the same configuration reuses the same ssl.SSLContext
before there was one ssl.SSLContext per client.

see https://github.com/encode/httpx/issues/978
2021-05-06 22:52:30 +02:00
Noémi Ványi d93ac96c9f
Merge pull request #2800 from kvch/add-httpx
Replace requests with httpx to speed up searx
2021-05-03 22:11:31 +02:00
Alexandre Flament 75d1f38b20 [fix] searxng fix: sjp engine 2021-05-03 21:51:29 +02:00
Alexandre Flament 8d2ea790de [fix] searx.network: fix rare cases where LOOP is None
* searx.network.client.LOOP is initialized in a thread
* searx.network.__init__ imports LOOP which may happen
  before the thread has initialized LOOP

This commit adds a new function "searx.network.client.get_loop()"
to fix this issue
2021-05-03 21:47:04 +02:00
Markus Heiser e3b6757234 [fix] drop 'idna' from requirements.txt
Requirement idna was added in 181c12ae04 but I don't know why.  This package
is not directly used by searxng but its a sub-requirement of some other packages
using package `requests` (with different range of supported versions, see
below).  In summary one can say: the version of idna should be depend on package
`requests`::

    ...
    Pallets-Sphinx-Themes==1.2.3
      ...
      - Sphinx [required: Any, installed: 3.5.4]
        ...
        - requests [required: >=2.5.0, installed: 2.25.1]
	  ...
          - idna [required: >=2.5,<3, installed: 2.10]
        ...
    ...
    transifex-client==0.14.2
      - requests [required: >=2.19.1,<3.0.0, installed: 2.25.1]
        ...
        - idna [required: >=2.5,<3, installed: 2.10]
    twine==3.4.1
      ...
      - requests [required: >=2.20, installed: 2.25.1]
        ...
        - idna [required: >=2.5,<3, installed: 2.10]

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-05-03 21:43:11 +02:00
Markus Heiser 4c43290b7d [fix] debug log: UnicodeEncodeError: 'ascii' codec can't encode
The issue exists only in the debug log::

     --- Logging error ---
     Traceback (most recent call last):
       File "/usr/lib/python3.9/logging/__init__.py", line 1086, in emit
	 stream.write(msg + self.terminator)
     UnicodeEncodeError: 'ascii' codec can't encode characters in position 79-89: ordinal not in range(128)
     Call stack:
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 2464, in __call__
	 return self.wsgi_app(environ, start_response)
       File "/usr/local/searx/searx-src/searx/webapp.py", line 1316, in __call__
	 return self.app(environ, start_response)
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/werkzeug/middleware/proxy_fix.py", line 169, in __call__
	 return self.app(environ, start_response)
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
	 response = self.full_dispatch_request()
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
	 rv = self.dispatch_request()
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
	 return self.view_functions[rule.endpoint](**req.view_args)
       File "/usr/local/searx/searx-src/searx/webapp.py", line 766, in search
	 number_of_results=format_decimal(number_of_results),
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask_babel/__init__.py", line 458, in format_decimal
	 locale = get_locale()
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask_babel/__init__.py", line 226, in get_locale
	 rv = babel.locale_selector_func()
       File "/usr/local/searx/searx-src/searx/webapp.py", line 249, in get_locale
	 logger.debug("%s uses locale `%s` from %s", request.url, locale, locale_source)
     Unable to print the message and arguments - possible formatting error.
     Use the traceback above to help find the error.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-05-03 21:41:21 +02:00
Alexandre Flament 14fe1779b7 [httpx] replace searx.poolrequests by searx.network
settings.yml:

* outgoing.networks:
   * can contains network definition
   * propertiers: enable_http, verify, http2, max_connections, max_keepalive_connections,
     keepalive_expiry, local_addresses, support_ipv4, support_ipv6, proxies, max_redirects, retries
   * retries: 0 by default, number of times searx retries to send the HTTP request (using different IP & proxy each time)
   * local_addresses can be "192.168.0.1/24" (it supports IPv6)
   * support_ipv4 & support_ipv6: both True by default
     see https://github.com/searx/searx/pull/1034
* each engine can define a "network" section:
   * either a full network description
   * either reference an existing network

* all HTTP requests of engine use the same HTTP configuration (it was not the case before, see proxy configuration in master)
2021-05-03 21:39:54 +02:00
Alexandre Flament 88a96baedc [enh] replace requests by httpx 2021-05-03 21:39:37 +02:00
Alexandre Flament 4415d25485 [fix] test: avoid HTTP requests
patch engine initialization to skip HTTP request
(engine_init function in searx.engines.initialize_engines)
2021-05-03 21:39:24 +02:00
Adam Tauber f045c385d1
Merge pull request #2799 from MarcAbonce/fix_qwant_locales
Fix Qwant's fetch_languages function
2021-05-03 12:13:07 +02:00
Marc Abonce Seguin 3284132ae5 fix Qwant's fetch_languages function 2021-05-02 17:24:28 -07:00
Noémi Ványi 540959b524
Merge pull request #2790 from searx/dependabot/pip/master/pylint-2.8.2
Bump pylint from 2.7.4 to 2.8.2
2021-05-02 20:58:14 +02:00