I am newbie in Python and given a task from my boss to do this :
- Grab streaming data from twitter in JSON
- Parsing using NLTK and Regular Expression
- Save it to file base or database file, ok
Is there anyone know how to grab a streaming data from twitte开发者_开发问答r using the step above ?
Your help would be very grateful :)
A quick Google search yields Tweepy, which is a python library for accessing the Twitter API. This should get you started. In terms of parsing the data, you'll need to be a little more specific as to what you want to parse.
This should point you in the right direction
import urllib2, simplejson
json = urllib2.urlopen('http://search.twitter.com/search.json?q=from%3Aalexiskold').read()
tweets = simplejson.loads(json)["results"]
for tweet in tweets: print tweet["text"]
it wouldn't eval
so i used simplejson
http://simplejson.github.com/simplejson/
You posted the same question twice, appearently: I answered in the other post. How to grab streaming data from twitter connect with pycurl using nltk - regular expression
精彩评论