diff options
author | dalf <alex@al-f.net> | 2014-10-11 15:49:50 +0200 |
---|---|---|
committer | dalf <alex@al-f.net> | 2014-10-11 15:49:50 +0200 |
commit | cac1761a54d4d72f9000e40cc04f05da3d78b7da (patch) | |
tree | 91ad912ed705b686e8f14c35c8a9d73a466739bf /searx/engines/duckduckgo_definitions.py | |
parent | 295b1699ced9b79f3b6e5e4375460ca6ddb64431 (diff) | |
download | searxng-cac1761a54d4d72f9000e40cc04f05da3d78b7da.tar.gz searxng-cac1761a54d4d72f9000e40cc04f05da3d78b7da.zip |
[enh] infoboxes : if the result doesn't contain anything except one link, use the normal result template
Diffstat (limited to 'searx/engines/duckduckgo_definitions.py')
-rw-r--r-- | searx/engines/duckduckgo_definitions.py | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py index 3da7352a4..c008f22f7 100644 --- a/searx/engines/duckduckgo_definitions.py +++ b/searx/engines/duckduckgo_definitions.py @@ -116,15 +116,22 @@ def response(resp): if len(heading)>0: # TODO get infobox.meta.value where .label='article_title' - results.append({ - 'infobox': heading, - 'id': infobox_id, - 'entity': entity, - 'content': content, - 'img_src' : image, - 'attributes': attributes, - 'urls': urls, - 'relatedTopics': relatedTopics - }) + if image==None and len(attributes)==0 and len(urls)==1 and len(relatedTopics)==0 and len(content)==0: + results.append({ + 'url': urls[0]['url'], + 'title': heading, + 'content': content + }) + else: + results.append({ + 'infobox': heading, + 'id': infobox_id, + 'entity': entity, + 'content': content, + 'img_src' : image, + 'attributes': attributes, + 'urls': urls, + 'relatedTopics': relatedTopics + }) return results |