叽叽喳喳转推用户ID API的Python [英] twitter retweet user id api python

查看:179
本文介绍了叽叽喳喳转推用户ID API的Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

,我需要知道如何让所有的转推鸣叫人民的所有用户ID。

using the twitter api with python, I need to know how to get all the user ids of all the people that retweeted a tweet.

我就在这里:的https://dev.twitter .COM /文档/ API / 1 /获取/状态/%3Aid / retweeted_by

但我不知道如何将它放入蟒蛇。

but I do not know how to put that into python.

这是我的code迄今:

here is my code so far:

from twitter import *
t = Twitter(auth=OAuth(....))
twitter = t.statuses.user_timeline.snl()

twitter[0]['text']           # gets the tweet
twitter[0]['retweet_count']  # gets the number of retweets

什么是我的下一行,让所有谁转推了用户的ID?

what is my next line to get the IDs of all the users who retweeted?

推荐答案

您应该使用的 Twitter的API 1.1 retweets_of_me retweeted_by 是德precated并不起作用。

You should use retweets_of_me for twitter API 1.1, retweeted_by is deprecated and doesn't work.

下面是一个例子:

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

希望有所帮助。

这篇关于叽叽喳喳转推用户ID API的Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆