summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2015-02-01 11:48:15 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2015-02-01 11:48:15 +0100
commit7e30633edd823d7692836320004e7a920210fdc0 (patch)
tree11f4dba82b940beea93ad002253b92ba1dd39f6a /searx
parent6042f2bc53d2b6f0d03e6b882db83377b27029be (diff)
downloadsearxng-7e30633edd823d7692836320004e7a920210fdc0.tar.gz
searxng-7e30633edd823d7692836320004e7a920210fdc0.zip
[enh] improve yacy engine
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/yacy.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/searx/engines/yacy.py b/searx/engines/yacy.py
index 4c4fac7df..17e2a7aab 100644
--- a/searx/engines/yacy.py
+++ b/searx/engines/yacy.py
@@ -68,9 +68,18 @@ def response(resp):
search_results = raw_search_results.get('channels', {})[0].get('items', [])
- if resp.search_params['category'] == 'general':
+ for result in search_results:
+ # parse image results
+ if result.get('image'):
+ # append result
+ results.append({'url': result['url'],
+ 'title': result['title'],
+ 'content': '',
+ 'img_src': result['image'],
+ 'template': 'images.html'})
+
# parse general results
- for result in search_results:
+ else:
publishedDate = parser.parse(result['pubDate'])
# append result
@@ -79,17 +88,7 @@ def response(resp):
'content': result['description'],
'publishedDate': publishedDate})
- elif resp.search_params['category'] == 'images':
- # parse image results
- for result in search_results:
- # append result
- results.append({'url': result['url'],
- 'title': result['title'],
- 'content': '',
- 'img_src': result['image'],
- 'template': 'images.html'})
-
- #TODO parse video, audio and file results
+ #TODO parse video, audio and file results
# return results
return results