Browse Source

[fix] proper html escaping

asciimoo 11 years ago
parent
commit
e47258ce38
1 changed files with 2 additions and 1 deletions
  1. 2 1
      searx/engines/stackoverflow.py

+ 2 - 1
searx/engines/stackoverflow.py

@@ -1,6 +1,7 @@
 from urllib import quote
 from lxml import html
 from urlparse import urljoin
+from cgi import escape
 
 base_url = 'http://stackoverflow.com/'
 search_url = base_url+'search?q='
@@ -20,6 +21,6 @@ def response(resp):
         link = result.xpath('.//div[@class="result-link"]//a')[0]
         url = urljoin(base_url, link.attrib.get('href'))
         title = ' '.join(link.xpath('.//text()'))
-        content = ' '.join(result.xpath('.//div[@class="excerpt"]//text()'))
+        content = escape(' '.join(result.xpath('.//div[@class="excerpt"]//text()')))
         results.append({'url': url, 'title': title, 'content': content})
     return results