mirror of
https://github.com/searxng/searxng.git
synced 2024-11-19 19:00:10 +01:00
[fix] html escape
This commit is contained in:
parent
ea414c6574
commit
111a86d355
@ -1,5 +1,6 @@
|
|||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
from lxml import html
|
from lxml import html
|
||||||
|
from cgi import escape
|
||||||
|
|
||||||
base_url = None
|
base_url = None
|
||||||
search_url = None
|
search_url = None
|
||||||
@ -35,11 +36,11 @@ def response(resp):
|
|||||||
if url.startswith('http://www.google.')\
|
if url.startswith('http://www.google.')\
|
||||||
or url.startswith('https://www.google.'):
|
or url.startswith('https://www.google.'):
|
||||||
continue
|
continue
|
||||||
title = link.text_content()
|
title = escape(link.text_content())
|
||||||
|
|
||||||
content = ''
|
content = ''
|
||||||
if result.xpath('./p[@class="desc"]'):
|
if result.xpath('./p[@class="desc"]'):
|
||||||
content = result.xpath('./p[@class="desc"]')[0].text_content()
|
content = escape(result.xpath('./p[@class="desc"]')[0].text_content())
|
||||||
|
|
||||||
results.append({'url': url, 'title': title, 'content': content})
|
results.append({'url': url, 'title': title, 'content': content})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user