微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何从推文中拉点赞数?

如何解决如何从推文中拉点赞数?

我们有以下代码,我们能够成功拉取推文,但是 Like 计数只是显示 None。

CelebritiesTwitterList = ["justinbieber","katyperry","rihanna","Cristiano","taylorswift13","ladygaga","ArianaGrande","TheEllenShow","KimKardashian","selenagomez"]

CelebTwitText = []
CelebTwitLikes = []

for profiles in CelebritiesTwitterList:
    
    tweets = tw.Cursor(api.user_timeline,screen_name=profiles,count=None,since_id=None,max_id=None,trim_user=True,exclude_replies=True,contributor_details=False,include_entities=False
                        ).items(100);
    
    OneAccountData = [tweet.text for tweet in tweets]
    OneAccountFavorites = [tweet.favorite_count for tweet in tweets] ### returns None
    CelebTwitText = CelebTwitText+OneAccountData
    CelebTwitLikes = CelebTwitLikes+OneAccountFavorites
    
celebDF = pd.DataFrame.from_dict({'Tweets':CelebTwitText,'Likes':CelebTwitLikes},orient='index')
celebDF = celebDF.transpose()
celebDF

我知道我们可以使用 tweet.retweeted_status.favorite_count,但这对我们也不起作用。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。