Browse Source

fix yacy result url

Closes #1064
Noémi Ványi 6 years ago
parent
commit
f3aa5ea47d
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      searx/engines/yacy.py

+ 10
- 1
searx/engines/yacy.py View File

74
     for result in search_results[0].get('items', []):
74
     for result in search_results[0].get('items', []):
75
         # parse image results
75
         # parse image results
76
         if result.get('image'):
76
         if result.get('image'):
77
+
78
+            result_url = ''
79
+            if 'url' in result:
80
+                result_url = result['url']
81
+            elif 'link' in result:
82
+                result_url = result['link']
83
+            else:
84
+                continue
85
+
77
             # append result
86
             # append result
78
-            results.append({'url': result['url'],
87
+            results.append({'url': result_url,
79
                             'title': result['title'],
88
                             'title': result['title'],
80
                             'content': '',
89
                             'content': '',
81
                             'img_src': result['image'],
90
                             'img_src': result['image'],