[enh] removing result html tags

This commit is contained in:
asciimoo 2013-11-09 18:39:20 +01:00
parent 14a53e3430
commit 17bf00ee42
4 changed files with 7 additions and 6 deletions

View file

@ -1,6 +1,7 @@
from urlparse import urljoin
from urllib import urlencode
from lxml import html
from cgi import escape
categories = ['social media']
@ -21,6 +22,6 @@ def response(resp):
link = tweet.xpath('.//small[@class="time"]//a')[0]
url = urljoin(base_url, link.attrib.get('href'))
title = ''.join(tweet.xpath('.//span[@class="username js-action-profile-name"]//text()'))
content = ''.join(map(html.tostring, tweet.xpath('.//p[@class="js-tweet-text tweet-text"]//*')))
content = escape(''.join(tweet.xpath('.//p[@class="js-tweet-text tweet-text"]//text()')))
results.append({'url': url, 'title': title, 'content': content})
return results