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
[mod] checker : replace pycld3 by langdetect
Alexandre Flamentaa887eb37522
diff --git a/requirements.txt b/requirements.txtindex 776bbc20b..a8d9b3f20 100644--- a/requirements.txt+++ b/requirements.txt@@ -9,4 +9,4 @@ pygments==2.1.3python-dateutil==2.8.1pyyaml==5.3.1requests[socks]==2.25.1-pycld3==0.20+langdetect==1.0.8diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.pyindex 244536f1b..25887b0f4 100644--- a/searx/search/checker/impl.py+++ b/searx/search/checker/impl.py@@ -9,7 +9,8 @@ from time import timefrom urllib.parse import urlparseimport re-import cld3+from langdetect import detect_langs+from langdetect.lang_detect_exception import LangDetectExceptionimport requests.exceptionsfrom searx import poolrequests, logger@@ -181,10 +182,14 @@ class ResultContainerTests:self.test_results.add_error(self.test_name, message, *args, '(' + sqstr + ')')def _add_language(self, text: str) -> typing.Optional[str]:- r = cld3.get_language(str(text)) # pylint: disable=E1101- if r is not None and r.probability >= 0.98 and r.is_reliable:- self.languages.add(r.language)- self.test_results.add_language(r.language)+ try:+ r = detect_langs(str(text)) # pylint: disable=E1101+ except LangDetectException:+ return None++ if len(r) > 0 and r[0].prob > 0.95:+ self.languages.add(r[0].lang)+ self.test_results.add_language(r[0].lang)return Nonedef _check_result(self, result):diff --git a/utils/searx.sh b/utils/searx.shindex f85935fa2..a33642ee4 100755--- a/utils/searx.sh+++ b/utils/searx.sh@@ -46,7 +46,6 @@ SEARX_PACKAGES_debian="\python3-dev python3-babel python3-venvuwsgi uwsgi-plugin-python3git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev-libprotobuf-dev protobuf-compilershellcheck"BUILD_PACKAGES_debian="\@@ -59,7 +58,6 @@ SEARX_PACKAGES_arch="\python python-pip python-lxml python-babeluwsgi uwsgi-plugin-pythongit base-devel libxml2-protobufshellcheck"BUILD_PACKAGES_arch="\@@ -71,7 +69,7 @@ SEARX_PACKAGES_fedora="\python python-pip python-lxml python-babeluwsgi uwsgi-plugin-python3git @development-tools libxml2-ShellCheck protobuf-compiler protobuf-devel"+ShellCheck"BUILD_PACKAGES_fedora="\firefox graphviz graphviz-gd ImageMagick librsvg2-tools@@ -84,7 +82,7 @@ SEARX_PACKAGES_centos="\python36 python36-pip python36-lxml python-babeluwsgi uwsgi-plugin-python3git @development-tools libxml2-ShellCheck protobuf-compiler protobuf-devel"+ShellCheck"BUILD_PACKAGES_centos="\firefox graphviz graphviz-gd ImageMagick librsvg2-tools