mirror of
https://github.com/searxng/searxng.git
synced 2025-07-31 00:52:22 +02:00
Add bing in the test units
This commit is contained in:
parent
44c9216c49
commit
525af2a031
4 changed files with 97 additions and 4 deletions
|
@ -14,6 +14,7 @@
|
|||
from urllib import urlencode
|
||||
from cgi import escape
|
||||
from lxml import html
|
||||
from searx.engines.xpath import extract_text
|
||||
|
||||
# engine dependent config
|
||||
categories = ['general']
|
||||
|
@ -55,8 +56,8 @@ def response(resp):
|
|||
for result in dom.xpath('//div[@class="sa_cc"]'):
|
||||
link = result.xpath('.//h3/a')[0]
|
||||
url = link.attrib.get('href')
|
||||
title = ' '.join(link.xpath('.//text()'))
|
||||
content = escape(' '.join(result.xpath('.//p//text()')))
|
||||
title = extract_text(link)
|
||||
content = escape(extract_text(result.xpath('.//p')))
|
||||
|
||||
# append result
|
||||
results.append({'url': url,
|
||||
|
@ -71,8 +72,8 @@ def response(resp):
|
|||
for result in dom.xpath('//li[@class="b_algo"]'):
|
||||
link = result.xpath('.//h2/a')[0]
|
||||
url = link.attrib.get('href')
|
||||
title = ' '.join(link.xpath('.//text()'))
|
||||
content = escape(' '.join(result.xpath('.//p//text()')))
|
||||
title = extract_text(link)
|
||||
content = escape(extract_text(result.xpath('.//p')))
|
||||
|
||||
# append result
|
||||
results.append({'url': url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue