having difficulty using twitter api command implemention in python

◇◆丶佛笑我妖孽 提交于 2019-12-11 19:21:44

问题


I am trying to implement this into python:

https://dev.twitter.com/docs/api/1.1/get/statuses/retweeters/ids

here is what I have so far:

def reqs():
t = Twitter(auth=OAuth('...'))
tweets = t.statuses.user_timeline.snl()

How do I get the user id's of those who retweeted a single tweet from the user's timeline?


回答1:


So after you would do this

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']))
    idList.append(retweets)

After this all you would have to just go through idList, and find the ids that only appear once in the list.




回答2:


Please see my solution at this post: difficulty using twitter api command implemention in python

It does use the Twyton API, however.




回答3:


use tweeters instead. boom. figured it out on my own

t.statuses.retweets(....)


来源:https://stackoverflow.com/questions/17169832/having-difficulty-using-twitter-api-command-implemention-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!