了解twitter流式api响应

问题描述 投票:1回答:1

我不是一个非常狂热的用户,因此很难弄清楚每个字段在twitter api响应中的含义。通过文档只会导致我进入圈子。

我想要做的是分析事情是如何变成病毒的。所以,我所做的是从twitter流式api中获取数据,希望分析响应,但我完全感到困惑。所以json的一个示例响应是:

{"created_at":"Thu Mar 14 18:19:12 +0000 2013","id":312266679390457857,"id_str":"312266679390457857","text":"The first four winners of our March Madness Giveaway (4x ADATA Technology (USA) 16GB DashDrives) are:\n\nAaron... http:\/\/t.co\/ikPbfRZQdq","source":"\u003ca href=\"http:\/\/www.facebook.com\/twitter\" rel=\"nofollow\"\u003eFacebook\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":179622147,"id_str":"179622147","name":"Levetron","screen_name":"Levetron","location":"Los Angeles","url":"http:\/\/www.aziocorp.com","description":"Official Twitter for Levetron by AZiO. Here for customer questions, gaming tips & tricks, sharing cool ideas, product launch releases, reviews and more!","protected":false,"followers_count":1042,"friends_count":25,"listed_count":4,"created_at":"Tue Aug 17 18:56:29 +0000 2010","favourites_count":5,"utc_offset":-28800,"time_zone":"Pacific Time (US & Canada)","geo_enabled":false,"verified":false,"statuses_count":707,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"131516","profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme14\/bg.gif","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme14\/bg.gif","profile_background_tile":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/3223061028\/999ac6efc782d85983cbcf7f2deab7c1_normal.png","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/3223061028\/999ac6efc782d85983cbcf7f2deab7c1_normal.png","profile_banner_url":"https:\/\/si0.twimg.com\/profile_banners\/179622147\/1360294489","profile_link_color":"009999","profile_sidebar_border_color":"EEEEEE","profile_sidebar_fill_color":"EFEFEF","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"entities":{"hashtags":[],"urls":[{"url":"http:\/\/t.co\/ikPbfRZQdq","expanded_url":"http:\/\/fb.me\/M6YPCk9W","display_url":"fb.me\/M6YPCk9W","indices":[112,134]}],"user_mentions":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium"}

1)我的猜测是,如果这条推文是转发的结果,那么“转推”应该是真的。但是,我如何弄清楚它转发给哪个用户? 2)“id”用户ID或推文ID?

基本上,如果我想说我想分析江南风格是如何传播病毒的......谁转发/关注那条特定的推文,我该怎么办呢?

此外,Twitter最近改变了它的api。我正在使用python,但在我看来,所有这些api的例子都不起作用

For example: https://github.com/tweepy/tweepy

有什么建议。谢谢

twitter tweepy
1个回答
1
投票

请参阅有关推文的Twitter API documentation。它描述了Twitter JSON响应中返回的所有参数。

那条推文没有被转发,因为retweeted设置为false而retweeted_count为0。

从文档:

id =此推文的唯一标识符的整数表示形式。

转发可以通过retweeted_status属性的存在与典型的推文区分开来。此属性包含转发的原始推文的表示形式。

此外,here是受支持的推特库列表。列出的除了tweepy之外还有其他几个库可能对您有用。

© www.soinside.com 2019 - 2024. All rights reserved.