BigSnarf blog

Infosec FTW

Python, Twitter, and “I hate my parents” – Christmas Meme?

Twitter Stream

Screen Shot 2013-12-25 at 10.15.18 AM

Python

Screen Shot 2013-12-25 at 10.19.06 AM

Results

Screen Shot 2013-12-25 at 10.18.47 AM

Screen Shot 2013-12-25 at 10.24.24 AM

 

 

Code

 

from twython import TwythonStreamer
class MyStreamer(TwythonStreamer):
 def on_success(self, data):
 if 'text' in data:
 print data['text'].encode('utf-8')
 def on_error(self, status_code, data):
 print status_code, data
stream = MyStreamer(APP_KEY, APP_SECRET,
 OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
# Tracking Twitter search term
stream.statuses.filter(track='iphone')

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: