mirror of https://github.com/searx/searx
Merge pull request #3367 from br4nnigan/master
allow engines to override pretty_url and use this in bing to show mea…
This commit is contained in:
commit
31eef5b9db
|
@ -68,11 +68,13 @@ def response(resp):
|
||||||
for result in eval_xpath(dom, '//div[@class="sa_cc"]'):
|
for result in eval_xpath(dom, '//div[@class="sa_cc"]'):
|
||||||
link = eval_xpath(result, './/h3/a')[0]
|
link = eval_xpath(result, './/h3/a')[0]
|
||||||
url = link.attrib.get('href')
|
url = link.attrib.get('href')
|
||||||
|
pretty_url = extract_text(eval_xpath(result, './/cite'))
|
||||||
title = extract_text(link)
|
title = extract_text(link)
|
||||||
content = extract_text(eval_xpath(result, './/p'))
|
content = extract_text(eval_xpath(result, './/p'))
|
||||||
|
|
||||||
# append result
|
# append result
|
||||||
results.append({'url': url,
|
results.append({'url': url,
|
||||||
|
'pretty_url': pretty_url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'content': content})
|
'content': content})
|
||||||
|
|
||||||
|
|
|
@ -647,7 +647,7 @@ def search():
|
||||||
# removing html content and whitespace duplications
|
# removing html content and whitespace duplications
|
||||||
result['title'] = ' '.join(html_to_text(result['title']).strip().split())
|
result['title'] = ' '.join(html_to_text(result['title']).strip().split())
|
||||||
|
|
||||||
if 'url' in result:
|
if 'url' in result and !('pretty_url' in result):
|
||||||
result['pretty_url'] = prettify_url(result['url'])
|
result['pretty_url'] = prettify_url(result['url'])
|
||||||
|
|
||||||
# TODO, check if timezone is calculated right
|
# TODO, check if timezone is calculated right
|
||||||
|
|
Loading…
Reference in New Issue