|
@@ -1,6 +1,6 @@
|
1
|
1
|
import json
|
2
|
2
|
from urllib import urlencode
|
3
|
|
-from re import sub
|
|
3
|
+from re import compile, sub
|
4
|
4
|
from lxml import html
|
5
|
5
|
from searx.utils import html_to_text
|
6
|
6
|
from searx.engines.xpath import extract_text
|
|
@@ -8,6 +8,8 @@ from searx.engines.xpath import extract_text
|
8
|
8
|
url = 'https://api.duckduckgo.com/'\
|
9
|
9
|
+ '?{query}&format=json&pretty=0&no_redirect=1&d=1'
|
10
|
10
|
|
|
11
|
+http_regex = compile(r'^http:')
|
|
12
|
+
|
11
|
13
|
|
12
|
14
|
def result_to_text(url, text, htmlResult):
|
13
|
15
|
# TODO : remove result ending with "Meaning" or "Category"
|
|
@@ -106,7 +108,7 @@ def response(resp):
|
106
|
108
|
|
107
|
109
|
# to merge with wikidata's infobox
|
108
|
110
|
if infobox_id:
|
109
|
|
- infobox_id = sub(r'^http:', r'https:', infobox_id)
|
|
111
|
+ infobox_id = http_regex.sub('https:', infobox_id)
|
110
|
112
|
|
111
|
113
|
# entity
|
112
|
114
|
entity = search_res.get('Entity', None)
|