Pārlūkot izejas kodu

[ehn] added ixquick engine, using startpage engine

pw3t 11 gadus atpakaļ
vecāks
revīzija
1dd35e9916
2 mainītis faili ar 15 papildinājumiem un 3 dzēšanām
  1. 8
    3
      searx/engines/startpage.py
  2. 7
    0
      settings.yml

+ 8
- 3
searx/engines/startpage.py Parādīt failu

3
 from urlparse import urlparse
3
 from urlparse import urlparse
4
 from cgi import escape
4
 from cgi import escape
5
 
5
 
6
-base_url = 'https://startpage.com/'
7
-search_url = base_url+'do/search'
6
+base_url = None
7
+search_url = None
8
 
8
 
9
 def request(query, params):
9
 def request(query, params):
10
     global search_url
10
     global search_url
26
         url = link.attrib.get('href')
26
         url = link.attrib.get('href')
27
         parsed_url = urlparse(url)
27
         parsed_url = urlparse(url)
28
         title = link.text_content()
28
         title = link.text_content()
29
-        content = result.xpath('./p[@class="desc"]')[0].text_content()
29
+
30
+        content =''
31
+        if len(result.xpath('./p[@class="desc"]')):
32
+            content = result.xpath('./p[@class="desc"]')[0].text_content()
33
+        
30
         results.append({'url': url, 'title': title, 'content': content})
34
         results.append({'url': url, 'title': title, 'content': content})
35
+    
31
     return results
36
     return results

+ 7
- 0
settings.yml Parādīt failu

68
 
68
 
69
   - name : startpage
69
   - name : startpage
70
     engine : startpage
70
     engine : startpage
71
+    base_url : 'https://startpage.com/'
72
+    search_url : 'https://startpage.com/do/search'
73
+
74
+  - name : ixquick
75
+    engine : startpage
76
+    base_url : 'https://www.ixquick.com/'
77
+    search_url : 'https://www.ixquick.com/do/search'
71
 
78
 
72
   - name : twitter
79
   - name : twitter
73
     engine : twitter
80
     engine : twitter