get_community_tweets.py 文件源码

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

项目:twitter_LDA_topic_modeling 作者: kenneth-orton 项目源码 文件源码
def get_tweets(user_id, api):
    cursor = tweepy.Cursor(api.user_timeline, user_id).pages()
    while True:
        try:
            tweets = [page for page in cursor]

        except tweepy.TweepError as e:
            tweets = []
            api_codes = [401, 404, 500]
            if not str(e): break
            if(int(filter(str.isdigit, str(e))) in api_codes): break
            print('get_tweets: ' + str(e))

    return tweets
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号