@@ -42,7 +42,9 @@ def extract_text(xpath_results):
4242 return ''.join(xpath_results)
4343 else:
4444 # it's a element
45− return html_to_text(xpath_results.text_content()).strip()
45+ text = html.tostring(xpath_results, encoding='unicode', method='text', with_tail=False)
46+ text = text.strip().replace('\n', ' ')
47+ return ' '.join(text.split())
4648
4749
4850def extract_url(xpath_results, search_url):