Skip to content

Instantly share code, notes, and snippets.

@adw
adw / ALLCAPS.py
Created November 2, 2012 02:08
HOW EXCITED IS DAN SINKER
import lxml.html
import lxml.cssselect
import urllib
import re
def main(victim):
sel = lxml.cssselect.CSSSelector('p.js-tweet-text')
tweets = sel(lxml.html.parse(victim))
tweet_text = [lxml.html.tostring(x, encoding="unicode", method="text").encode("ascii", "ignore").strip() for x in tweets]
# ignoring whitespace...