|
@@ -3,8 +3,8 @@ from lxml import html
|
3
|
3
|
from urlparse import urlparse
|
4
|
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
|
9
|
def request(query, params):
|
10
|
10
|
global search_url
|
|
@@ -26,6 +26,11 @@ def response(resp):
|
26
|
26
|
url = link.attrib.get('href')
|
27
|
27
|
parsed_url = urlparse(url)
|
28
|
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
|
34
|
results.append({'url': url, 'title': title, 'content': content})
|
|
35
|
+
|
31
|
36
|
return results
|