2015-07-13

PYTHON - Twitter search and results parsing

# 1. Twitter authentication credentials (get yours at dev.twitter.com)
consumerKey = ''
consumerSecret = ''

# 2. Create a twython object (installation command: "sudo easy_install twython")
from twython import Twython
twitter = Twython( consumerKey, consumerSecret )

# 3. Display tweets' text matching a given search term
term = 'chapo'
for status in twitter.search(q=term)["statuses"]:  
    print status["text"]

No comments:

Post a Comment