Example #1
0
        # Add the user's number of tweets total
        if username in user_number_of_tweets_overall:
            user_number_of_tweets_overall[username] += 1
        else:
            user_number_of_tweets_overall[username] = 1

        # Add the user's followers
        # note, the else is removed
        # we want the MOST RECENT followers for that user
        if username not in user_number_of_followers:
            user_number_of_followers[username] = th.get_num_followers(line)

        # Add the tweets's retweets
        if tweet_id not in number_of_retweets_per_tweet:
            number_of_retweets_per_tweet[tweet_id] = th.get_num_retweets(line)

    # Add tweets per hour for each user
    print('Detecting for tweets per hour...')
    for i, tweet in enumerate(tweets):
        # get the current tweet date and username
        tweet_dt = th.get_tweet_dt(tweet)
        username = th.get_username(tweet)

        j = i - 1
        hours = 0
        hits = 1
        while j > 0 and hours <= 1:
            # get the next previous tweet's date and username
            previous_tweet_dt = th.get_tweet_dt(tweets[j])
            previous_tweet_username = th.get_username(tweets[j])