Exemple #1
0
    def __init__(self, rootpath, folderpath, start, end, originhashtag):
        """Initialize the parameters.

        Parameters
        ----------
        rootpath : str
            the root path of the data
        folderpath : str
            the folder path of the data
        start : str
            the start date of the query
            format: 'yyyy-mm-dd'
        end : str
            the end date of the query
            format: 'yyyy-mm-dd'
        originhashtag : str
            the original query hashtag

        Returns
        -------
        None

        """
        self.rootpath = rootpath
        self.folderpath = folderpath
        self.start = start
        self.end = end
        self.filename = "tweets.pkl"
        self.originhashtag = originhashtag
        self.helper = Utility.Helper(rootpath)
        self.addressTweet = Twitter.AddressTweet(rootpath)
        self.getTwitter = Twitter.GetTwitterData(rootpath)
Exemple #2
0
    def getHistoricalTweets(self, username, foldername):
        """Get the historical tweets of user.

        Parameters
        ----------
        username : str
            the username of account without '@'

        Returns
        -------
        None
            save the tweet object in username.pkl file

        """
        tweetFlag = True
        getTwitterData = Twitter.GetTwitterData(self.rootPath)
        criteria = getTwitterData.setCriteria(username=username)
        getTwitterData.getTweets(criteria, foldername, username + ".pkl",
                                 tweetFlag)