from twython import Twython usuario = "ajamaica" twitter = Twython() followers = twitter.getFollowersIDs( screen_name = usuario ) for follower_id in followers : print "Usuarios %d sigue a %s" % (follower_id, usuario) tweets = twitter.getPublicTimeline() for tweet in tweets : print tweet['user']['name'].encode('utf-8') print tweet['text'].encode('utf-8') results = twitter.getDailyTrends() for i in range(0,100) : print i for time, trend_list in results['trends'].iteritems() : print time for trend in trend_list : print trend['query']
from twython import Twython """ Instantiate Twython with no Authentication """ twitter = Twython() trends = twitter.getDailyTrends() print trends
from twython import Twython usuario = "ajamaica" twitter = Twython() followers = twitter.getFollowersIDs(screen_name=usuario) for follower_id in followers: print "Usuarios %d sigue a %s" % (follower_id, usuario) tweets = twitter.getPublicTimeline() for tweet in tweets: print tweet['user']['name'].encode('utf-8') print tweet['text'].encode('utf-8') results = twitter.getDailyTrends() for i in range(0, 100): print i for time, trend_list in results['trends'].iteritems(): print time for trend in trend_list: print trend['query']
import numpy as np from twython import Twython twitter = Twython() trends = twitter.getDailyTrends(exclude='hashtags') for trend in trends['trends']: # loop index is over time of pop trends print trends['trends'][trend][0]['query'] # trends{'trends':2012-1-31 19:00:[{"name":"...", "query":"...}]