summaryrefslogtreecommitdiff
path: root/searx/engines/json_engine.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2017-12-01 20:45:24 +0100
committerAdam Tauber <asciimoo@gmail.com>2017-12-01 20:54:12 +0100
commit0969e50c5bc949d2c15eaed8e6a7def6b9da00fa (patch)
tree7f7a77190b67585956e6109a882c68a934030bab /searx/engines/json_engine.py
parenta065fcdcc95beaf7028b55c9bd82591add99a890 (diff)
downloadsearxng-0969e50c5bc949d2c15eaed8e6a7def6b9da00fa.tar.gz
searxng-0969e50c5bc949d2c15eaed8e6a7def6b9da00fa.zip
[fix] convert json engine result attributes to string - closes #1006
Diffstat (limited to 'searx/engines/json_engine.py')
-rw-r--r--searx/engines/json_engine.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/searx/engines/json_engine.py b/searx/engines/json_engine.py
index eeae5c235..785b0c490 100644
--- a/searx/engines/json_engine.py
+++ b/searx/engines/json_engine.py
@@ -2,6 +2,7 @@ from collections import Iterable
from json import loads
from sys import version_info
from searx.url_utils import urlencode
+from searx.utils import to_string
if version_info[0] == 3:
unicode = str
@@ -111,14 +112,22 @@ def response(resp):
content = query(result, content_query)[0]
except:
content = ""
- results.append({'url': url, 'title': title, 'content': content})
+ results.append({
+ 'url': to_string(url),
+ 'title': to_string(title),
+ 'content': to_string(content),
+ })
else:
for url, title, content in zip(
query(json, url_query),
query(json, title_query),
query(json, content_query)
):
- results.append({'url': url, 'title': title, 'content': content})
+ results.append({
+ 'url': to_string(url),
+ 'title': to_string(title),
+ 'content': to_string(content),
+ })
if not suggestion_query:
return results