summaryrefslogtreecommitdiff
path: root/searx/engines/bing.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/engines/bing.py')
-rw-r--r--searx/engines/bing.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/engines/bing.py b/searx/engines/bing.py
index 5de461cfe..f9c323d05 100644
--- a/searx/engines/bing.py
+++ b/searx/engines/bing.py
@@ -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,