|
@@ -1,8 +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'
|
|
4
|
+base_url = None
|
|
5
|
+search_url = None
|
6
|
6
|
|
7
|
7
|
|
8
|
8
|
def request(query, params):
|
|
@@ -24,6 +24,11 @@ def response(resp):
|
24
|
24
|
link = result.xpath('.//h3/a')[0]
|
25
|
25
|
url = link.attrib.get('href')
|
26
|
26
|
title = link.text_content()
|
27
|
|
- content = result.xpath('./p[@class="desc"]')[0].text_content()
|
|
27
|
+
|
|
28
|
+ content =''
|
|
29
|
+ if len(result.xpath('./p[@class="desc"]')):
|
|
30
|
+ content = result.xpath('./p[@class="desc"]')[0].text_content()
|
|
31
|
+
|
28
|
32
|
results.append({'url': url, 'title': title, 'content': content})
|
|
33
|
+
|
29
|
34
|
return results
|