|
@@ -4,6 +4,7 @@ from lxml import html
|
4
|
4
|
base_url = None
|
5
|
5
|
search_url = None
|
6
|
6
|
|
|
7
|
+
|
7
|
8
|
def request(query, params):
|
8
|
9
|
global search_url
|
9
|
10
|
query = urlencode({'q': query})[2:]
|
|
@@ -24,10 +25,10 @@ def response(resp):
|
24
|
25
|
url = link.attrib.get('href')
|
25
|
26
|
title = link.text_content()
|
26
|
27
|
|
27
|
|
- content =''
|
|
28
|
+ content = ''
|
28
|
29
|
if len(result.xpath('./p[@class="desc"]')):
|
29
|
30
|
content = result.xpath('./p[@class="desc"]')[0].text_content()
|
30
|
|
-
|
|
31
|
+
|
31
|
32
|
results.append({'url': url, 'title': title, 'content': content})
|
32
|
|
-
|
|
33
|
+
|
33
|
34
|
return results
|