diff options
author | a01200356 <a01200356@itesm.mx> | 2016-03-14 00:32:36 -0600 |
---|---|---|
committer | a01200356 <a01200356@itesm.mx> | 2016-04-17 16:22:19 -0500 |
commit | 8d335dbdaedd6113242e785e8fabac86128d069a (patch) | |
tree | ecd75df0c02b19b7a6de5290d061fc4bf731e521 /searx/results.py | |
parent | 817c74e52317126128c6f8740df01b8bdc51c3cf (diff) | |
download | searxng-8d335dbdaedd6113242e785e8fabac86128d069a.tar.gz searxng-8d335dbdaedd6113242e785e8fabac86128d069a.zip |
[enh] wikipedia infobox
creates simple multilingual infobox using wikipedia's api
Diffstat (limited to 'searx/results.py')
-rw-r--r-- | searx/results.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/searx/results.py b/searx/results.py index 5d51eb5b5..c3040b305 100644 --- a/searx/results.py +++ b/searx/results.py @@ -37,7 +37,7 @@ def merge_two_infoboxes(infobox1, infobox2): urls1 = infobox1.get('urls', None) if urls1 is None: urls1 = [] - infobox1.set('urls', urls1) + infobox1['urls'] = urls1 urlSet = set() for url in infobox1.get('urls', []): @@ -47,11 +47,17 @@ def merge_two_infoboxes(infobox1, infobox2): if url.get('url', None) not in urlSet: urls1.append(url) + if 'img_src' in infobox2: + img1 = infobox1.get('img_src', None) + img2 = infobox2.get('img_src') + if img1 is None: + infobox1['img_src'] = img2 + if 'attributes' in infobox2: attributes1 = infobox1.get('attributes', None) if attributes1 is None: attributes1 = [] - infobox1.set('attributes', attributes1) + infobox1['attributes'] = attributes1 attributeSet = set() for attribute in infobox1.get('attributes', []): @@ -68,7 +74,7 @@ def merge_two_infoboxes(infobox1, infobox2): if result_content_len(content2) > result_content_len(content1): infobox1['content'] = content2 else: - infobox1.set('content', content2) + infobox1['content'] = content2 def result_score(result): |