mirror of
https://github.com/searx/searx
synced 2024-11-22 09:57:08 +01:00
allow engines to override pretty_url and use this in bing to show meaningful urls
This commit is contained in:
parent
2222caec22
commit
a9dadda6f7
@ -68,11 +68,13 @@ def response(resp):
|
||||
for result in eval_xpath(dom, '//div[@class="sa_cc"]'):
|
||||
link = eval_xpath(result, './/h3/a')[0]
|
||||
url = link.attrib.get('href')
|
||||
pretty_url = extract_text(eval_xpath(result, './/cite'))
|
||||
title = extract_text(link)
|
||||
content = extract_text(eval_xpath(result, './/p'))
|
||||
|
||||
# append result
|
||||
results.append({'url': url,
|
||||
'pretty_url': pretty_url,
|
||||
'title': title,
|
||||
'content': content})
|
||||
|
||||
|
@ -647,7 +647,7 @@ def search():
|
||||
# removing html content and whitespace duplications
|
||||
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'])
|
||||
|
||||
# TODO, check if timezone is calculated right
|
||||
|
Loading…
Reference in New Issue
Block a user