Commit graph

37 commits

Author SHA1 Message Date
dalf
915c0a2bc6 Update searx.data - update_languages.py 2022-08-29 02:09:27 +00:00
Markus Heiser
6579d6d558 [fix] qwant - API error::locale must be one ..
The request function should not request a language (aka locale) that is not
supported by qwant. Select a locale like zh-TW ends in qwant's API error:

  ERROR searx.engines.qwant news: exception : \
  API error::locale must be one of the following values: \
    en_gb, en_ie, en_us, en_ca, en_my, en_au, en_nz, de_de, de_ch, de_at, fr_fr, \
    fr_be, fr_ch, fr_ca, fr_ad, fc_ca, co_fr, es_es, es_ar, es_cl, es_co, es_mx, \
    es_pe, es_ad, ca_es, ca_ad, ca_fr, eu_es, eu_fr, it_it, it_ch, pt_pt, pt_ad, \
    nl_be, nl_nl

The existing searx.utils.match_language function is unsuitable for this purpose,
it is replaced by function searx.locales.get_engine_locale that is based on the
methods from the babel package.

The quant's _fetch_supported_languages function has been revised to filter out
languages 8aka locales) not supported by qwant.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-08-14 10:36:14 +02:00
dalf
90068b3d0b Update searx.data - update_languages.py 2022-07-29 02:00:53 +00:00
dalf
012d7fcaa0 Update searx.data - update_languages.py 2022-06-01 06:31:54 +00:00
Markus Heiser
62982c8812 [fix] add back missing languages & regions (followup of PR #1071)
In PR #1071 the language catalog of dailymotion has been cleaned up, before
there had been over 7000 "languages" in the catalog.

As a side effect of this clean-up the language & region catalog in SearXNG has
been reduced [1].

This patch reduce the ``min_engines_per_lang`` from 13 to 12 to get the missed
languages back in language & region catalog of SearXNG.

[1] 3bb62823ec (diff-f3f00db0f87f95b882624a192e0aac21525638af0b18c9514e765fcf1991678d)

Requested-by: @tiekoetter in a Matrix chat
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-04-22 12:09:42 +02:00
Markus Heiser
3bb62823ec [fix] dailymotion engine: filter by language & country
- fix the issue of fetching more the 7000 *languages*
- improve the request function and filter by language & country
- implement time_range_support & safesearch
- add more fields to the response from dailymotion (allow_embed, length)
- better clean up of HTML tags in the 'content' field.

This is more or less a complete rework based on the '/videos' API from [1].
This patch cleans up the language list in SearXNG that has been polluted by the
ISO-639-3 2 and 3 letter codes from dailymotion languages which have never been
used.

[1] https://developers.dailymotion.com/tools/

Closes: https://github.com/searxng/searxng/issues/1065
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-04-16 09:27:34 +02:00
Alexandre FLAMENT
7d31b2c0af Update languages 2022-03-31 20:04:46 +00:00
Markus Heiser
3cdf2d6570 Update searx.data - update_languages.py
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-01 18:37:35 +01:00
dalf
c74b465ece Update searx.data - update_languages.py 2021-12-01 06:24:47 +00:00
Markus Heiser
f63ffbb22b [fix] engine - yahoo: rewrite and fix issues
Languages are supported by mapping the language to a domain.  If domain is not
found in :py:obj:`lang2domain` URL ``<lang>.search.yahoo.com`` is used.

BTW: fix issue reported at https://github.com/searx/searx/issues/3020

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-10-16 20:05:26 +00:00
Markus Heiser
97419a770d [upd] make data.languages
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-10-01 20:01:41 +02:00
dalf
db51a64390 Update searx.data - update_languages.py 2021-10-01 06:23:31 +00:00
dalf
4d3f2f48d2 Update searx.data - update_languages.py 2021-08-01 06:24:12 +00:00
Markus Heiser
ef6e1bd6b9 [fix] Qwant engines - implement API v3 and add 'quant videos'
The implementation uses the Qwant API (https://api.qwant.com/v3). The API is
undocumented but can be reverse engineered by reading the network log of
https://www.qwant.com/ queries.

This implementation is used by different qwant engines in the settings.yml::

  - name: qwant
    categories: general
    ...
  - name: qwant news
    categories: news
    ...
  - name: qwant images
    categories: images
    ...
  - name: qwant videos
    categories: videos
    ...

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-07-14 09:47:32 +02:00
Alexandre Flament
cf2b549967 Update engines_languages.json 2021-06-04 16:17:22 +02:00
Marc Abonce Seguin
448bfe6005 fix Qwant's fetch_languages function 2021-05-02 17:46:40 -07:00
dalf
c0668d248e Update searx.data - update_languages.py 2021-04-01 07:00:46 +00:00
dalf
d9dc3376d0 Update searx.data - update_languages.py 2021-03-05 10:56:46 +00:00
Markus Heiser
d48e2e7b0b [enh] google scholar - python implementation of the engine
The old xpath configuration for google scholar did not work and is replaced by a
python implementation.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-03-01 15:16:37 +01:00
Markus Heiser
ff6804e545 [data] make engines.languages
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-01-24 09:52:32 +01:00
Marc Abonce Seguin
ecf5899153 fetch google's search langs rather than ui langs 2020-09-22 11:37:44 +02:00
Marc Abonce Seguin
c86504b47a fix utils/fetch_languages to work with new languages 2020-09-22 11:37:44 +02:00
Michael Ilsaas
a1ce141c99
add peertube engine (#2109) 2020-08-08 19:22:53 +02:00
Markus Heiser
79412828cd update languages: engines_languages.json languages.py
build by Makefile target:

    make project

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-03-01 08:06:51 +01:00
Markus Heiser
40843fe95a searx/data/engines_languages.json: sort json file (no content change)
To get meaningfull diffs, the json file has to be sorted.  Before applying any
further content patch, the json file needs a inital sort (without changing any
content).

Sorted by::

  import sys, json

  with open('engines_languages.json') as f:
      j = json.load(f)

  with open('engines_languages.json', 'w') as f:
      json.dump(j, f, indent=2, sort_keys=True)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-03-01 07:56:46 +01:00
Marc Abonce Seguin
0169b63e84 [fix] fetch google's supported languages 2019-01-06 21:31:45 -06:00
Ivan Skytte Jørgensen
0b7f0bde62 Use a more human-friendly format in searx/data/engines_languages.json (#1399)
Instead of a single line with 500000 characters use nicely formatted JSON.
Sort the lists in engine_languages.py so when updating it is possible to
more easily see the differences (search engines do change the order their
languages are listed in)
2018-11-29 16:31:05 +01:00
Marc Abonce Seguin
772c048d01 refactor engine's search language handling
Add match_language function in utils to match any user given
language code with a list of engine's supported languages.

Also add language_aliases dict on each engine to translate
standard language codes into the custom codes used by the engine.
2018-03-27 00:08:03 -06:00
Marc Abonce Seguin
d1eae9359f fix fetch_langauges to be more accurate
Add languages supported by either all default general engines or 10 engines.
2018-03-20 17:58:20 -06:00
marc
44085e31d0 update engines_languages.json and languages.py
Also, fix fetch_languages.py so it can run on python3.
2017-10-10 16:53:28 -05:00
marc
405e5c8f24 [fix] duckduckgo images doesn't fail with countryless language 2017-07-10 18:41:50 +02:00
marc
fd65c12921 make search language handling less strict
languages.py can change, so users may query on a language that is not
on the list anymore, even if it is still recognized by a few engines.

also made no and nb the same because they seem to return the same,
though most engines will only support one or the other.
2017-03-18 23:44:21 +01:00
marc
805fb02ed1 add language support for qwant
closes issue #863
2017-03-18 23:44:21 +01:00
marc
1175b3906f change language list to only include languages with a minimum of engines
that support them.
users can still query lesser supported through the :lang_code bang.
2016-12-29 01:55:30 -06:00
marc
4a1ff56389 minor fixes in utils/fetch_languages.py 2016-12-16 22:14:14 -06:00
marc
af35eee10b tests for _fetch_supported_languages in engines
and refactor method to make it testable without making requests
2016-12-15 00:40:21 -06:00
marc
f62ce21f50 [mod] fetch supported languages for several engines
utils/fetch_languages.py gets languages supported by each engine and
generates engines_languages.json with each engine's supported language.
2016-12-13 19:58:10 -06:00