Exemple #1
0
    def index(self, config):
        c = twint.Config()
        c.Search = config["search_term"]
        c.Since = config["uploaded_after"]
        c.Until = config["uploaded_before"]
        c.Show_hashtags = True
        c.Store_object = True

        twint.run.Search(c)

        tweets = to_serializable(twint.output.tweets_list, as_list=True)
        return LocalElementsIndex(tweets)
Exemple #2
0
    def get_all_tweets_sent_to(self, username):
        """ See https://github.com/twintproject/twint/issues/513 """
        c = twint.Config()
        c.To = f"@{username}"
        c.Retweets = True
        c.Since = self.config["uploaded_after"]
        c.Until = self.config["uploaded_before"]
        c.Store_object = True
        self.logger(f"Scraping tweets sent to {username}...")
        twint.run.Search(c)
        results = twint.output.tweets_list
        twint.output.tweets_list = []

        return to_serializable(results)