问题
No one seems to be able to answer my question and I can not find it in the other posts. Using twitter's api, I want to enter in a tweet id and return an array of all the users who retweeted that tweet.
example:
input -> retweeters(tweet_id)
output -> ['username1','username2','username3','username4']
This can be done with this link
I do not need the tweet or the retweet, I need the usernames of the people who retweeted a particular tweet so therefore retweets_of_me would not be helpful here. If you help me out, I'd be very grateful. Thank you
回答1:
GET statuses/mentions can be used. That API call returns any mentions of a user, and you can pass the flag include_rts. This will include any retweets of your tweets. If you wanted to list RTs of a specific tweet, you could check the in_reply_to_status_id field in the returned data to see if it matches the original tweet ID.
However even this has a limit (I expect quite higher though) So you will have to do it in a repetitive polling fashion
回答2:
You can use twython, which allows you to access the Twitter API and collect the list of retweeter IDs with the following code:
from twython import Twython
twitter = Twython(APP_KEY, APP_SECRET,OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
search = twitter.get_retweeters_ids(id=327473909412814850)
for result in search["ids"]:
print result
The get_retweeters_ids()
function takes the same arguments as the Twitter API call, which is the id of the Tweet you want to track. The result is a JSON object that contains the retweeter IDs in the field "ids".
I hope this helps.
来源:https://stackoverflow.com/questions/17172169/difficulty-using-twitter-api-command-implemention-in-python