diff --git a/searx/engines/qwant.py b/searx/engines/qwant.py index cee2dfa975903c0a50969de5b8ccecb35c3a612f..e2ac19465662ee551e290c60e2275668e291b6ac 100644 --- a/searx/engines/qwant.py +++ b/searx/engines/qwant.py @@ -93,6 +93,8 @@ def request(query, params): supported_languages, language_aliases, ) + if language not in supported_languages: + language = 'en-US' params['url'] += '&locale=' + language.replace('-', '_') params['raise_for_httperror'] = False diff --git a/searx/settings.yml b/searx/settings.yml index 2057c4dd87e08d58a42464e2f2052a108d507d20..c0568975966d394926eef59c932f3af5c27fae5a 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -412,7 +412,7 @@ engines: - name: wikidata engine: wikidata shortcut: wd - timeout: 3.0 + timeout: 6.0 weight: 2 tests: *tests_infobox @@ -589,6 +589,7 @@ engines: - name : google images engine : google_images shortcut : goi + timeout: 6.0 # additional_tests: # android: *test_android # dali: @@ -741,19 +742,11 @@ engines: - name : invidious engine : invidious - base_url : - - https://invidious.tube/ - - https://invidious.snopyta.org/ + base_url : https://invidious.weblibre.org/ shortcut: iv timeout : 5.0 disabled : True - - name: kickass - engine : kickass - shortcut : kc - timeout : 4.0 - disabled : True - - name : library genesis engine : xpath paging : True diff --git a/searx/webapp.py b/searx/webapp.py index 5a0f279a48c35cc11bfdee25c5ac54e9e39ee73f..2d5c780b6bb22013ffbd9be4fe7c16bb899e0417 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -619,7 +619,7 @@ def search(): # output_format output_format = request.form.get('format', 'html') - if output_format not in ['html', 'csv', 'json', 'rss']: + if output_format not in ['html', 'rss']: output_format = 'html' # check if there is query (not None and not an empty string) diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index 92f6bb119710c4d284c87d35db1ae3aa0d529b34..e67093d8996cfdaee464fdb89d9633c485efc404 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import json from urllib.parse import ParseResult from mock import Mock from searx.testing import SearxTestCase @@ -98,14 +97,6 @@ class ViewsTestCase(SearxTestCase): self.assertEqual(result.status_code, 200) self.assertIn(b'Spot', result.data) - def test_search_empty_json(self): - result = self.app.post('/search', data={'q': '', 'format': 'json'}) - self.assertEqual(result.status_code, 400) - - def test_search_empty_csv(self): - result = self.app.post('/search', data={'q': '', 'format': 'csv'}) - self.assertEqual(result.status_code, 400) - def test_search_empty_rss(self): result = self.app.post('/search', data={'q': '', 'format': 'rss'}) self.assertEqual(result.status_code, 400) @@ -124,33 +115,6 @@ class ViewsTestCase(SearxTestCase): result.data ) - def test_index_json(self): - result = self.app.post('/', data={'q': 'test', 'format': 'json'}) - self.assertEqual(result.status_code, 308) - - def test_search_json(self): - result = self.app.post('/search', data={'q': 'test', 'format': 'json'}) - result_dict = json.loads(result.data.decode()) - - self.assertEqual('test', result_dict['query']) - self.assertEqual(len(result_dict['results']), 2) - self.assertEqual(result_dict['results'][0]['content'], 'first test content') - self.assertEqual(result_dict['results'][0]['url'], 'http://first.test.xyz') - - def test_index_csv(self): - result = self.app.post('/', data={'q': 'test', 'format': 'csv'}) - self.assertEqual(result.status_code, 308) - - def test_search_csv(self): - result = self.app.post('/search', data={'q': 'test', 'format': 'csv'}) - - self.assertEqual( - b'title,url,content,host,engine,score,type\r\n' - b'First Test,http://first.test.xyz,first test content,first.test.xyz,startpage,,result\r\n' # noqa - b'Second Test,http://second.test.xyz,second test content,second.test.xyz,youtube,,result\r\n', # noqa - result.data - ) - def test_index_rss(self): result = self.app.post('/', data={'q': 'test', 'format': 'rss'}) self.assertEqual(result.status_code, 308)