def print_all_tweets_which_contain_Stick2Me(self):
     allFollowerTweetsWhichContainStick2Me = self.get_follower_tweets_which_contain_Stick2Me()
     myTweetsWhichContainStick2Me = self.get_my_tweets_which_contain_Stick2Me()
     
     allTweetsWhichContainStick2Me = allFollowerTweetsWhichContainStick2Me + myTweetsWhichContainStick2Me
     allTweetsWhichContainStick2MeSortedByDate = sorted(allTweetsWhichContainStick2Me, key=lambda tweet: tweet.created_at, reverse = True)
     
     PrintHelper.print_header("Tweets that contain Stick2Me or @TVZ_dkoscica\nNumber of tweets: " + str(len(allTweetsWhichContainStick2MeSortedByDate)))
     for tweet in allTweetsWhichContainStick2MeSortedByDate:
         PrintHelper.print_tweet(tweet)
def main():

    tweepyWrapper = TweepyWrapper()

    tweepyWrapper.print_user_information()

    tweepyWrapper.print_all_my_followers()
    tweepyWrapper.print_most_influential_followers()

    tweepyWrapper.print_all_tweets_from_me()
    tweepyWrapper.print_retweets_of_me()

    #allFollowerTweetsWhichContainStick2Me = tweepyWrapper.get_follower_tweets_which_contain_Stick2Me()
    #tweepyWrapper.print_all_tweets_which_contain_Stick2Me()

    pyMongoWrapper = PyMongoWrapper()
    #pyMongoWrapper.insert_all_tweets(allFollowerTweetsWhichContainStick2Me)
    #pyMongoWrapper.print_all_collection_tweets()

    collectionNames = pyMongoWrapper.get_all_collection_names()
    """
    Basic data analytics
    """
    for collectionName in collectionNames:
        PrintHelper.print_header("Collection name: " + collectionName)
        pyMongoWrapper.print_collection(collectionName)
    """"
    NLTK
    """
    nltkWrapper = NLTKWrapper()

    #targetCollectionName = "tweets.From_2017_02_08_To_2017_02_15"
    for collectionName in collectionNames:
        PrintHelper.print_header("Collection name: " + collectionName)
        tweetTextSummaryFromCollection = pyMongoWrapper.get_tweet_text_summary_for_collection(
            collectionName)
        nltkWrapper.analize_text(collectionName,
                                 tweetTextSummaryFromCollection)
    """
    SNA
    """
    targetCollectionName = "tweets.all"
    for collectionName in collectionNames:
        if collectionName in targetCollectionName:
            PrintHelper.print_header("Collection name: " + collectionName)
            vertexes = pyMongoWrapper.get_tweet_vertexes_for_collection(
                collectionName)
            SNAWrapper(collectionName, vertexes).create_sna_analysis_html()
示例#3
0
 def __init__(self):
     PrintHelper.print_header("NLTKWrapper created!\nIgnored words:" +
                              str(self.__ignored_words))
 def print_most_influential_followers(self):
     PrintHelper.print_header("Top 10 most influential followers")
     for follower in self.get_most_influential_followers()[:10]:
        PrintHelper. print_user(follower)  
 def print_all_my_followers(self):
     PrintHelper.print_header("All my followers")
     for follower in self.get_my_followers():
         PrintHelper.print_user(follower)
 def print_user_information(self):
     PrintHelper.print_header("Get all the information about @TVZ_dkoscica")
     user = self.api.me()
     PrintHelper.print_user(user)
 def print_retweets_of_me(self):
     retweets = self.api.retweets_of_me()
     numberOfRetweets = str(len(retweets))
     PrintHelper.print_header("Retweets of me\nNumber of retweets: "  + numberOfRetweets)
     for tweet in retweets:
         PrintHelper.print_tweet(tweet)
 def print_all_tweets_from_me(self):
     PrintHelper.print_header("All tweets from @TVZ_dkoscica")
     for tweet in self.get_all_my_tweets():
         PrintHelper.print_tweet(tweet)