コード例 #1
0
ファイル: test5.py プロジェクト: juicyJ/citybeat_online
def testWithExtendedTweets():
    ti = TweetInterface(collection=TwitterConfig.extended_tweet_collection)
    tweets = {}
    most_popular_tweet = ''
    max_retweet_count = -1
    for tweet in ti.getAllFields(fields='text'):
        text = tweet['text']
        count = tweets.get(text, 0)
        count += 1
        tweets[text] = count
        if count > max_retweet_count:
            max_retweet_count = count
            most_popular_tweet = text

    print most_popular_tweet, max_retweet_count
    print len(tweets)