summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-20 09:51:24 +0100
committerGitHub <noreply@github.com>2020-12-20 09:51:24 +0100
commit59217bb5bed86926b2bbd84f406ed022b0762c6e (patch)
treed65eb74cbe46be6813afdf9907de5941cbbb9a4d /searx/engines
parent04447f8c1a32aa2d1a2209d0a120ce04435c1346 (diff)
parent3f8ebf70b193f4391a01d7412324a10e4faa56a2 (diff)
Merge pull request #2397 from dalf/update-ci
updates for Python 3.9 / update CI
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/elasticsearch.py12
-rw-r--r--searx/engines/ina.py5
2 files changed, 8 insertions, 9 deletions
diff --git a/searx/engines/elasticsearch.py b/searx/engines/elasticsearch.py
index 081736c1c..0e2d35756 100644
--- a/searx/engines/elasticsearch.py
+++ b/searx/engines/elasticsearch.py
@@ -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}}}}
@@ -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}}}
@@ -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(',')}}}
diff --git a/searx/engines/ina.py b/searx/engines/ina.py
index 52c939498..ce241d409 100644
--- a/searx/engines/ina.py
+++ b/searx/engines/ina.py
@@ -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
@@ -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: