Przeglądaj źródła

fix yacy result url

Closes #1064
Noémi Ványi 6 lat temu
rodzic
commit
f3aa5ea47d
1 zmienionych plików z 10 dodań i 1 usunięć
  1. 10
    1
      searx/engines/yacy.py

+ 10
- 1
searx/engines/yacy.py Wyświetl plik

@@ -74,8 +74,17 @@ def response(resp):
74 74
     for result in search_results[0].get('items', []):
75 75
         # parse image results
76 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 86
             # append result
78
-            results.append({'url': result['url'],
87
+            results.append({'url': result_url,
79 88
                             'title': result['title'],
80 89
                             'content': '',
81 90
                             'img_src': result['image'],