@@ -9,6 +9,7 @@
9# @parse url, title, content, suggestion
9# @parse url, title, content, suggestion
12+from cgi import escape
12from urllib import urlencode
13from urllib import urlencode
13from urlparse import urlparse, parse_qsl
14from urlparse import urlparse, parse_qsl
14from lxml import html
15from lxml import html
@@ -167,7 +168,7 @@ def parse_url(url_string, google_hostname):
167def extract_text_from_dom(result, xpath):
168def extract_text_from_dom(result, xpath):
168 r = result.xpath(xpath)
169 r = result.xpath(xpath)
169 if len(r) > 0:
170 if len(r) > 0:
170− return extract_text(r[0])
171+ return escape(extract_text(r[0]))
171 return None
172 return None
@@ -273,7 +274,7 @@ def response(resp):
273 # parse suggestion
274 # parse suggestion
274 for suggestion in dom.xpath(suggestion_xpath):
275 for suggestion in dom.xpath(suggestion_xpath):
275 # append suggestion
276 # append suggestion
276− results.append({'suggestion': extract_text(suggestion)})
277+ results.append({'suggestion': escape(extract_text(suggestion))})
278 # return results
279 # return results
279 return results
280 return results