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