|
@@ -8,6 +8,7 @@ search_url = None
|
8
|
8
|
url_xpath = None
|
9
|
9
|
content_xpath = None
|
10
|
10
|
title_xpath = None
|
|
11
|
+suggestion_xpath = ''
|
11
|
12
|
results_xpath = ''
|
12
|
13
|
|
13
|
14
|
def extract_url(xpath_results):
|
|
@@ -56,5 +57,8 @@ def response(resp):
|
56
|
57
|
for content, url, title in zip(dom.xpath(content_xpath), map(extract_url, dom.xpath(url_xpath)), dom.xpath(title_xpath)):
|
57
|
58
|
results.append({'url': url, 'title': title, 'content': content})
|
58
|
59
|
|
59
|
|
-
|
|
60
|
+ if not suggestion_xpath:
|
|
61
|
+ return results
|
|
62
|
+ for suggestion in dom.xpath(suggestion_xpath):
|
|
63
|
+ results.append({'suggestion': escape(''.join(suggestion.xpath('.//text()')))})
|
60
|
64
|
return results
|