@@ -0,0 +1,26 @@
1+from urlparse import urljoin
2+from urllib import urlencode
5+categories = ['social media']
7+base_url = 'https://twitter.com/'
8+search_url = base_url+'search?'
10+def request(query, params):
12+ params['url'] = search_url + urlencode({'q': query})
19+ dom = html.fromstring(resp.text)
20+ for tweet in dom.xpath('//li[@data-item-type="tweet"]'):
21+ link = tweet.xpath('.//small[@class="time"]//a')[0]
22+ url = urljoin(base_url, link.attrib.get('href'))
23+ title = ''.join(tweet.xpath('.//span[@class="username js-action-profile-name"]//text()'))
24+ content = ''.join(map(html.tostring, tweet.xpath('.//p[@class="js-tweet-text tweet-text"]//*')))
25+ results.append({'url': url, 'title': title, 'content': content})