浏览代码

Merge pull request #29 from pw3t/ixquick

Ixquick
Adam Tauber 11 年前
父节点
当前提交
f1db60d28f
共有 3 个文件被更改,包括 22 次插入4 次删除
  1. 8
    4
      searx/engines/startpage.py
  2. 7
    0
      searx/settings.yml
  3. 7
    0
      searx/settings_robot.yml

+ 8
- 4
searx/engines/startpage.py 查看文件

1
 from urllib import urlencode
1
 from urllib import urlencode
2
 from lxml import html
2
 from lxml import html
3
 
3
 
4
-base_url = 'https://startpage.com/'
5
-search_url = base_url+'do/search'
6
-
4
+base_url = None
5
+search_url = None
7
 
6
 
8
 def request(query, params):
7
 def request(query, params):
9
     global search_url
8
     global search_url
24
         link = result.xpath('.//h3/a')[0]
23
         link = result.xpath('.//h3/a')[0]
25
         url = link.attrib.get('href')
24
         url = link.attrib.get('href')
26
         title = link.text_content()
25
         title = link.text_content()
27
-        content = result.xpath('./p[@class="desc"]')[0].text_content()
26
+
27
+        content =''
28
+        if len(result.xpath('./p[@class="desc"]')):
29
+            content = result.xpath('./p[@class="desc"]')[0].text_content()
30
+        
28
         results.append({'url': url, 'title': title, 'content': content})
31
         results.append({'url': url, 'title': title, 'content': content})
32
+    
29
     return results
33
     return results

+ 7
- 0
searx/settings.yml 查看文件

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

+ 7
- 0
searx/settings_robot.yml 查看文件

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