【问题标题】:Understanding twitter streaming api response了解 twitter 流 api 响应
【发布时间】:2013-05-01 18:21:19
【问题描述】:

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

基本上,如果假设我想分析(比如说)Gangham 风格是如何传播开来的......谁转发/关注了该特定推文,我应该怎么做?

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

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

任何建议。 谢谢

【问题讨论】:

    标签: twitter tweepy


    【解决方案1】:

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

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

    来自文档:

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

    转推与典型推文的区别在于 一个 retweeted_status 属性。该属性包含一个表示 被转发的原始推文。

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

    【讨论】:

    • 链接不再有效
    猜你喜欢
    • 2018-10-30
    • 1970-01-01
    • 2019-03-13
    • 2011-07-12
    • 2019-08-01
    • 2019-09-23
    • 2016-07-26
    • 2020-10-25
    • 1970-01-01
    相关资源
    最近更新 更多