我们如何提取完整的转推网络的推文

时间:2018-02-23 04:23:14

标签: python api twitter graph sna

我想制作推文的完整转发网络。例如,用户A转推了2个他的粉丝B和C. D和E,他们是B的追随者,转发了同样的推文,转发了B. 当我使用twitter API编写python代码时,它会返回由B,C,D,E转发的A的推文...... 我有兴趣获得实际的网络。

user = "k"
from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream


ACCESS_TOKEN = ''
ACCESS_SECRET = ''
CONSUMER_KEY = ''
CONSUMER_SECRET = ''


twitter = Twitter ( auth = OAuth(ACCESS_TOKEN, ACCESS_SECRET, CONSUMER_KEY, 
CONSUMER_SECRET)) 

results = twitter.statuses.user_timeline(screen_name = user)

for status in results:
     print ("@%s %s" % (user, status["text"]))

    retweets = twitter.statuses.retweets._id(_id = status["id"])
     for retweet in retweets:
         print (" - retweeted by %s" % (retweet["user"]["screen_name"]))

请指导我或发送正确的链接 感谢

0 个答案:

没有答案