diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2016-04-19 20:40:48 +0200 |
|---|---|---|
| committer | Adam Tauber <asciimoo@gmail.com> | 2016-04-19 20:40:48 +0200 |
| commit | f46057feb24132ef10c495a2e60e1a88dd80dd31 (patch) | |
| tree | 1a136070c8acd73449ba6e0a4d74b52ed8b0bce6 /searx/results.py | |
| parent | 817c74e52317126128c6f8740df01b8bdc51c3cf (diff) | |
| parent | a44faa77167980a414df2cbe936a52359351f455 (diff) | |
Merge pull request #540 from a01200356/wikipedia_infobox
[enh] wikipedia infobox
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): |