parsing real-time data using twitter streaming api
DESCRIPTION
TRANSCRIPT
Parsing Real-time Tweets
Ramanujam ParthasarathyMonetate
@ramanujamhttp://github.com/ramanujam
Wednesday, May 30, 12
Why?
• Freely available public intelligence
• News reaches twitter super fast and spreads
• 250 million tweets per day (Oct ‘11)
• Track keywords, sentiment analysis, data mining
• Because you can!
Wednesday, May 30, 12
Twitter Streaming APIhttps://stream.twitter.com/1/statuses/filter.json
Wednesday, May 30, 12
Twitter Streaming API
curl https://stream.twitter.com/1/statuses/filter.json?track=SEARCH_PARAMETER -uUSERNAME:PASSWORD
Wednesday, May 30, 12
Twitter Python Libraries
• Tweepy• Python Oauth2• Python Twitter• Twython• Twitty Twister• Tweetstream
Use a library that has support for Oauth
Wednesday, May 30, 12
Get your auth keys
Wednesday, May 30, 12
Basic keyword/hashtag tracking
Print the status
Set the keywords to track
File: tracker.py
Wednesday, May 30, 12
Save to MongoDB
Pymongo (http://api.mongodb.org/python/2.2/index.html) is a recommended way to work with MongoDB from Python
Wednesday, May 30, 12
Plot some dataPie chart of the devices used by people who tweet about Obama and Romney
File: plotapps.py
Wednesday, May 30, 12
Play some music#pugmusic
http:\/\/tinysong.com\/6OAB
Wednesday, May 30, 12
Play some music
File: playmusic.py
Wednesday, May 30, 12
Enqueue more songs
• Grooveshark javascript api
• addSongsByID
• window.Grooveshark.addSongsByID(13766524)
Wednesday, May 30, 12
NotifyTwilio API to send a text or make a call based on an event trigger (eg: > 10 statuses in a 10 second window)
setTerms = ['$AAPL', 'down', '530']setTerms = [‘aws’, ‘down’]setTerms = [‘phillies’, ‘win’]
File: sendtext.pyWednesday, May 30, 12
Thank You!
http://github.com/ramanujam/pugtalk
Wednesday, May 30, 12