浏览代码

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,9 +1,8 @@
1 1
 from urllib import urlencode
2 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 7
 def request(query, params):
9 8
     global search_url
@@ -24,6 +23,11 @@ def response(resp):
24 23
         link = result.xpath('.//h3/a')[0]
25 24
         url = link.attrib.get('href')
26 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 31
         results.append({'url': url, 'title': title, 'content': content})
32
+    
29 33
     return results

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

@@ -68,6 +68,13 @@ engines:
68 68
 
69 69
   - name : startpage
70 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 79
   - name : twitter
73 80
     engine : twitter

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

@@ -68,6 +68,13 @@ engines:
68 68
 
69 69
   - name : startpage
70 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 79
   - name : twitter
73 80
     engine : twitter