了解twitter流式api响应

时间:2013-05-01 18:21:20

标签: twitter tweepy

我不是一个非常狂热的用户,因此很难弄清楚每个字段在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?

基本上,如果我想说,我想分析一下(比方说)Gangham风格是如何传播病毒的......谁转发/关注那条特定的推文,我该怎么做?

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

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

任何建议。 感谢

1 个答案:

答案 0 :(得分:1)

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

由于retweeted设置为false且retweeted_count为0,因此该推文未被转发。

来自文档:

  

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

     转发可以通过存在而与典型的推文区分开来   retweeted_status属性。该属性包含一个表示   被转发的原始推文。

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