Easitter.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:Easitter 作者: TomoyaFujita2016 项目源码 文件源码
def searchTweets(self, tag, limit=50000, tfilter=" -filter:retweets", resultType="recent"):
        # if tfilter is appended to tag, it'll have some problem about tqdm, or what???.
        # I don't know why it'll have the problem.
        #tag += tfilter
        try:
            tweets = []
            tweetsObj = tweepy.Cursor(self.API.search, 
                    q=tag, 
                    result_type=resultType,
                    exclude_replies = True).items(limit)

            pBar = tqdm(tweetsObj, ascii=True, total=limit, desc="Getting Tweets!")
            for cnt, tweet in enumerate(pBar):
                pBar.update(1)
                if not cnt < limit:
                    break
                tweets.append(tweet)
        except tweepy.error.TweepError as et:
            print(et)
        except Exception as e:
            print(e)
        return tweets

    # if the tweets has more than 2 tweet which is tweeted by same user, it delete old tweet.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号