twitter_api.py 文件源码

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

项目:PolBotCheck 作者: codeforfrankfurt 项目源码 文件源码
def get_followers(screen_name):
    timestamp = datetime.now()
    log_doc = {
        'accounts': {
            screen_name: {
                'started_at': timestamp.timestamp()
            }
        }
    }
    db.saveToImportLog(IMPORT_KEY, log_doc)
    if FOLLOWER_LIMIT == 0:
        print("Get all followers for @" + screen_name)
    else:
        print("Get %d followers for @%s" % (FOLLOWER_LIMIT, screen_name))
    print(timestamp.strftime("%d.%m.%Y %H:%M:%S"))
    followers = []
    for user in limit_handled(tweepy.Cursor(TWITTER_API.followers, screen_name="@"+screen_name, count=200).items(FOLLOWER_LIMIT)):
        followers.append(user)
    return followers

# def get_all_retweeters(screen_name):
#     timestamp = time.strftime("%d.%m.%Y %H:%M:%S", time.localtime())
#     print(timestamp)
#     all_retweeters = []
#     for tweet in limit_handled(tweepy.Cursor(api.user_timeline, id=screen_name, count=200).items()):
#         print(tweet.id)
#         retweeters = get_retweets(tweet.id)
#         # somehow get to retweeters
#         # all_retweeters.append(retweeters_per_tweet)
#     return all_retweeters
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号