Loading .github/workflows/integration.yml +7 −0 Original line number Diff line number Diff line Loading @@ -22,7 +22,14 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: 'x64' - name: Cache Python dependencies id: cache-python uses: actions/cache@v2 with: path: ./local key: python-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt', 'setup.py') }} - name: Install Python dependencies if: steps.cache-python.outputs.cache-hit != 'true' run: | make V=1 install make V=1 gecko.driver Loading searx/engines/elasticsearch.py +6 −6 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ def _match_query(query): try: key, value = query.split(':') except: raise ValueError('query format must be "key:value"') except Exception as e: raise ValueError('query format must be "key:value"') from e return {"query": {"match": {key: {'query': value}}}} Loading @@ -71,8 +71,8 @@ def _term_query(query): try: key, value = query.split(':') except: raise ValueError('query format must be key:value') except Exception as e: raise ValueError('query format must be key:value') from e return {'query': {'term': {key: value}}} Loading @@ -86,8 +86,8 @@ def _terms_query(query): try: key, values = query.split(':') except: raise ValueError('query format must be key:value1,value2') except Exception as e: raise ValueError('query format must be key:value1,value2') from e return {'query': {'terms': {key: values.split(',')}}} Loading searx/engines/ina.py +2 −3 Original line number Diff line number Diff line Loading @@ -12,10 +12,10 @@ # @todo embedded (needs some md5 from video page) from json import loads from html import unescape from urllib.parse import urlencode from lxml import html from dateutil import parser from html.parser import HTMLParser from searx.utils import extract_text Loading Loading @@ -55,13 +55,12 @@ def response(resp): if "content" not in response: return [] dom = html.fromstring(response["content"]) p = HTMLParser() # parse results for result in dom.xpath(results_xpath): videoid = result.xpath(url_xpath)[0] url = base_url + videoid title = p.unescape(extract_text(result.xpath(title_xpath))) title = unescape(extract_text(result.xpath(title_xpath))) try: thumbnail = extract_text(result.xpath(thumbnail_xpath)[0]) except: Loading searx/settings_loader.py +2 −2 Original line number Diff line number Diff line Loading @@ -24,9 +24,9 @@ def load_yaml(file_name): with open(file_name, 'r', encoding='utf-8') as settings_yaml: return yaml.safe_load(settings_yaml) except IOError as e: raise SearxSettingsException(e, file_name) raise SearxSettingsException(e, file_name) from e except yaml.YAMLError as e: raise SearxSettingsException(e, file_name) raise SearxSettingsException(e, file_name) from e def get_default_settings_path(): Loading searx/utils.py +2 −2 Original line number Diff line number Diff line Loading @@ -522,7 +522,7 @@ def get_xpath(xpath_spec): try: result = XPath(xpath_spec) except XPathSyntaxError as e: raise SearxXPathSyntaxException(xpath_spec, str(e.msg)) raise SearxXPathSyntaxException(xpath_spec, str(e.msg)) from e xpath_cache[xpath_spec] = result return result Loading Loading @@ -553,7 +553,7 @@ def eval_xpath(element, xpath_spec): return xpath(element) except XPathError as e: arg = ' '.join([str(i) for i in e.args]) raise SearxEngineXPathException(xpath_spec, arg) raise SearxEngineXPathException(xpath_spec, arg) from e def eval_xpath_list(element, xpath_spec, min_len=None): Loading Loading
.github/workflows/integration.yml +7 −0 Original line number Diff line number Diff line Loading @@ -22,7 +22,14 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: 'x64' - name: Cache Python dependencies id: cache-python uses: actions/cache@v2 with: path: ./local key: python-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt', 'setup.py') }} - name: Install Python dependencies if: steps.cache-python.outputs.cache-hit != 'true' run: | make V=1 install make V=1 gecko.driver Loading
searx/engines/elasticsearch.py +6 −6 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ def _match_query(query): try: key, value = query.split(':') except: raise ValueError('query format must be "key:value"') except Exception as e: raise ValueError('query format must be "key:value"') from e return {"query": {"match": {key: {'query': value}}}} Loading @@ -71,8 +71,8 @@ def _term_query(query): try: key, value = query.split(':') except: raise ValueError('query format must be key:value') except Exception as e: raise ValueError('query format must be key:value') from e return {'query': {'term': {key: value}}} Loading @@ -86,8 +86,8 @@ def _terms_query(query): try: key, values = query.split(':') except: raise ValueError('query format must be key:value1,value2') except Exception as e: raise ValueError('query format must be key:value1,value2') from e return {'query': {'terms': {key: values.split(',')}}} Loading
searx/engines/ina.py +2 −3 Original line number Diff line number Diff line Loading @@ -12,10 +12,10 @@ # @todo embedded (needs some md5 from video page) from json import loads from html import unescape from urllib.parse import urlencode from lxml import html from dateutil import parser from html.parser import HTMLParser from searx.utils import extract_text Loading Loading @@ -55,13 +55,12 @@ def response(resp): if "content" not in response: return [] dom = html.fromstring(response["content"]) p = HTMLParser() # parse results for result in dom.xpath(results_xpath): videoid = result.xpath(url_xpath)[0] url = base_url + videoid title = p.unescape(extract_text(result.xpath(title_xpath))) title = unescape(extract_text(result.xpath(title_xpath))) try: thumbnail = extract_text(result.xpath(thumbnail_xpath)[0]) except: Loading
searx/settings_loader.py +2 −2 Original line number Diff line number Diff line Loading @@ -24,9 +24,9 @@ def load_yaml(file_name): with open(file_name, 'r', encoding='utf-8') as settings_yaml: return yaml.safe_load(settings_yaml) except IOError as e: raise SearxSettingsException(e, file_name) raise SearxSettingsException(e, file_name) from e except yaml.YAMLError as e: raise SearxSettingsException(e, file_name) raise SearxSettingsException(e, file_name) from e def get_default_settings_path(): Loading
searx/utils.py +2 −2 Original line number Diff line number Diff line Loading @@ -522,7 +522,7 @@ def get_xpath(xpath_spec): try: result = XPath(xpath_spec) except XPathSyntaxError as e: raise SearxXPathSyntaxException(xpath_spec, str(e.msg)) raise SearxXPathSyntaxException(xpath_spec, str(e.msg)) from e xpath_cache[xpath_spec] = result return result Loading Loading @@ -553,7 +553,7 @@ def eval_xpath(element, xpath_spec): return xpath(element) except XPathError as e: arg = ' '.join([str(i) for i in e.args]) raise SearxEngineXPathException(xpath_spec, arg) raise SearxEngineXPathException(xpath_spec, arg) from e def eval_xpath_list(element, xpath_spec, min_len=None): Loading