|
@@ -46,12 +46,11 @@ def request(query, params):
|
46
|
46
|
def response(resp):
|
47
|
47
|
results = []
|
48
|
48
|
dom = html.fromstring(resp.text)
|
49
|
|
- query = resp.search_params['query']
|
50
|
49
|
if results_xpath:
|
51
|
50
|
for result in dom.xpath(results_xpath):
|
52
|
51
|
url = extract_url(result.xpath(url_xpath))
|
53
|
52
|
title = ' '.join(result.xpath(title_xpath))
|
54
|
|
- content = escape(' '.join(result.xpath(content_xpath))).replace(query, '<b>{0}</b>'.format(query))
|
|
53
|
+ content = escape(' '.join(result.xpath(content_xpath)))
|
55
|
54
|
results.append({'url': url, 'title': title, 'content': content})
|
56
|
55
|
else:
|
57
|
56
|
for content, url, title in zip(dom.xpath(content_xpath), map(extract_url, dom.xpath(url_xpath)), dom.xpath(title_xpath)):
|