diff options
author | asciimoo <asciimoo@gmail.com> | 2013-10-17 20:43:05 +0200 |
---|---|---|
committer | asciimoo <asciimoo@gmail.com> | 2013-10-17 20:43:05 +0200 |
commit | e47258ce38fe4313a5a6881c54bd9fb14c8619c7 (patch) | |
tree | 363027a925406fd324015d797e7b4d6d46a48c7d /searx/engines/stackoverflow.py | |
parent | 48839295d3939212a0fe4bf86297081a22dcb7ac (diff) | |
download | searxng-e47258ce38fe4313a5a6881c54bd9fb14c8619c7.tar.gz searxng-e47258ce38fe4313a5a6881c54bd9fb14c8619c7.zip |
[fix] proper html escaping
Diffstat (limited to 'searx/engines/stackoverflow.py')
-rw-r--r-- | searx/engines/stackoverflow.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/engines/stackoverflow.py b/searx/engines/stackoverflow.py index fb0d65cdf..24afe9eac 100644 --- a/searx/engines/stackoverflow.py +++ b/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 |