为了账号安全,请及时绑定邮箱和手机立即绑定

Twitter转推用户ID api python

Twitter转推用户ID api python

弑天下 2021-03-28 15:11:47
使用带有Python的twitter api,我需要知道如何获取所有转发了tweet信息的人的所有用户ID。我去了这里:https : //dev.twitter.com/docs/api/1/get/statuses/%3Aid/retweeted_by但我不知道如何将其放入python。到目前为止,这是我的代码:from twitter import *t = Twitter(auth=OAuth(....))twitter = t.statuses.user_timeline.snl()twitter[0]['text']           # gets the tweettwitter[0]['retweet_count']  # gets the number of retweets下一条要获取所有转发用户的ID的下一行是什么?
查看完整描述

1 回答

?
凤凰求蛊

TA贡献1825条经验 获得超4个赞

您应该对twitter API 1.1使用retweets_of_me,retweeted_by它已被弃用并且不起作用。


这是一个例子:


from twitter import *


t = Twitter(auth=OAuth(...))


tweets = t.statuses.user_timeline.snl()


for tweet in tweets:

    retweets = t.statuses.retweets_of_me(since_id=str(tweet['id']), max_id=str(tweet['id']))

    print retweets

希望能有所帮助。


查看完整回答
反对 回复 2021-04-02
  • 1 回答
  • 0 关注
  • 160 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号