简体   繁体   English

“跟随”键在获取好友/列表API Twitter中始终返回false

[英]“following” key always returns false in get friends/list API Twitter

when I am testing my app with GET friends/list API of twitter the "following" key of the JSON always turn up to be false/null even if the user following me . 当我使用Twitter的GET朋友/列表API测试我的应用时,即使用户关注我,JSON的“跟随”键也总是显示为false / null。 Why does this scenario keep occuring? 为什么这种情况不断发生?

Sample JSON 样本JSON

 { "users": [{ "id": 103550181, "id_str": "103550181", "name": "Crowdfire", "screen_name": "Crowdfire", "location": "Everywhere", "description": "Publish, engage and grow better on Twitter and Instagram. Available on mobile and web. 13 million users.", "url": "https:\\/\\/t.co\\/MEjmtjz2An", "entities": { "url": { "urls": [{ "url": "https:\\/\\/t.co\\/MEjmtjz2An", "expanded_url": "http:\\/\\/www.crowdfireapp.com", "display_url": "crowdfireapp.com", "indices": [0, 23] }] }, "description": { "urls": [] } }, "protected": false, "followers_count": 4270829, "friends_count": 202935, "listed_count": 6121, "created_at": "Sun Jan 10 11:47:21 +0000 2010", "favourites_count": 6434, "utc_offset": 19800, "time_zone": "Mumbai", "geo_enabled": true, "verified": false, "statuses_count": 33003, "lang": "en", "status": { "created_at": "Thu Jan 14 17:20:38 +0000 2016", "id": 687685769708711936, "id_str": "687685769708711936", "text": "@NaveenS16 would you like to name some of them? #cfchat", "source": "\Twitter Web Client\<\\/a\>", "truncated": false, "in_reply_to_status_id": 687685529454809088, "in_reply_to_status_id_str": "687685529454809088", "in_reply_to_user_id": 749455278, "in_reply_to_user_id_str": "749455278", "in_reply_to_screen_name": "NaveenS16", "geo": null, "coordinates": null, "place": null, "contributors": null, "retweet_count": 25, "favorite_count": 58, "entities": { "hashtags": [{ "text": "cfchat", "indices": [48, 55] }], "symbols": [], "user_mentions": [{ "screen_name": "NaveenS16", "name": "Naveen-Themesfinity", "id": 749455278, "id_str": "749455278", "indices": [0, 10] }], "urls": [] }, "favorited": false, "retweeted": false, "lang": "en" }, "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "0099B9", "profile_background_image_url": "http:\\/\\/abs.twimg.com\\/images\\/themes\\/theme4\\/bg.gif", "profile_background_image_url_https": "https:\\/\\/abs.twimg.com\\/images\\/themes\\/theme4\\/bg.gif", "profile_background_tile": false, "profile_image_url": "http:\\/\\/pbs.twimg.com\\/profile_images\\/615941584706650112\\/nYaFiaed_normal.png", "profile_image_url_https": "https:\\/\\/pbs.twimg.com\\/profile_images\\/615941584706650112\\/nYaFiaed_normal.png", "profile_banner_url": "https:\\/\\/pbs.twimg.com\\/profile_banners\\/103550181\\/1450267030", "profile_link_color": "0099B9", "profile_sidebar_border_color": "5ED4DC", "profile_sidebar_fill_color": "95E8EC", "profile_text_color": "3C3940", "profile_use_background_image": true, "has_extended_profile": false, "default_profile": false, "default_profile_image": false, "following": false, "follow_request_sent": false, "notifications": false, "muting": false, "blocking": false, "blocked_by": false }, { "id": 4176844046, "id_str": "4176844046", "name": "Anamika Nayan", "screen_name": "anamika_nayan", "location": "", "description": "", "url": null, "entities": { "description": { "urls": [] } }, "protected": false, "followers_count": 1, "friends_count": 41, "listed_count": 0, "created_at": "Mon Nov 09 07:27:26 +0000 2015", "favourites_count": 0, "utc_offset": null, "time_zone": null, "geo_enabled": false, "verified": false, "statuses_count": 0, "lang": "en", "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http:\\/\\/abs.twimg.com\\/images\\/themes\\/theme1\\/bg.png", "profile_background_image_url_https": "https:\\/\\/abs.twimg.com\\/images\\/themes\\/theme1\\/bg.png", "profile_background_tile": false, "profile_image_url": "http:\\/\\/abs.twimg.com\\/sticky\\/default_profile_images\\/default_profile_4_normal.png", "profile_image_url_https": "https:\\/\\/abs.twimg.com\\/sticky\\/default_profile_images\\/default_profile_4_normal.png", "profile_link_color": "0084B4", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "has_extended_profile": false, "default_profile": true, "default_profile_image": true, "following": false, "follow_request_sent": false, "notifications": false, "muting": false, "blocking": false, "blocked_by": false }, { "id": 29921858, "id_str": "29921858", "name": "Sandip Saha", "screen_name": "withsandip", "location": "", "description": "Technology geek | Co-founder @ Innofied Solution Pvt Ltd | Husband to a lovely wife.", "url": "http:\\/\\/t.co\\/y7Swu7hNK6", "entities": { "url": { "urls": [{ "url": "http:\\/\\/t.co\\/y7Swu7hNK6", "expanded_url": "http:\\/\\/www.sandipsaha.com", "display_url": "sandipsaha.com", "indices": [0, 22] }] }, "description": { "urls": [] } }, "protected": false, "followers_count": 161, "friends_count": 288, "listed_count": 3, "created_at": "Thu Apr 09 04:36:46 +0000 2009", "favourites_count": 2, "utc_offset": null, "time_zone": null, "geo_enabled": false, "verified": false, "statuses_count": 75, "lang": "en", "status": { "created_at": "Fri Jan 08 04:21:37 +0000 2016", "id": 685315393624248320, "id_str": "685315393624248320", "text": "RT @innofied: 16 New Year Resolutions to Welcome 2016 in Innofied - https:\\/\\/t.co\\/6dUq8h6WmZ via @innofied", "source": "\Twitter for Android\<\\/a\>", "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, "geo": null, "coordinates": null, "place": null, "contributors": null, "retweeted_status": { "created_at": "Thu Jan 07 12:08:24 +0000 2016", "id": 685070477706919936, "id_str": "685070477706919936", "text": "16 New Year Resolutions to Welcome 2016 in Innofied - https:\\/\\/t.co\\/6dUq8h6WmZ via @innofied", "source": "\Twitter Web Client\<\\/a\>", "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, "geo": null, "coordinates": null, "place": null, "contributors": null, "retweet_count": 4, "favorite_count": 1, "entities": { "hashtags": [], "symbols": [], "user_mentions": [{ "screen_name": "innofied", "name": "Innofied", "id": 461027581, "id_str": "461027581", "indices": [82, 91] }], "urls": [{ "url": "https:\\/\\/t.co\\/6dUq8h6WmZ", "expanded_url": "http:\\/\\/goo.gl\\/lmRKJK", "display_url": "goo.gl\\/lmRKJK", "indices": [54, 77] }] }, "favorited": false, "retweeted": false, "possibly_sensitive": false, "lang": "en" }, "retweet_count": 4, "favorite_count": 0, "entities": { "hashtags": [], "symbols": [], "user_mentions": [{ "screen_name": "innofied", "name": "Innofied", "id": 461027581, "id_str": "461027581", "indices": [3, 12] }, { "screen_name": "innofied", "name": "Innofied", "id": 461027581, "id_str": "461027581", "indices": [96, 105] }], "urls": [{ "url": "https:\\/\\/t.co\\/6dUq8h6WmZ", "expanded_url": "http:\\/\\/goo.gl\\/lmRKJK", "display_url": "goo.gl\\/lmRKJK", "indices": [68, 91] }] }, "favorited": false, "retweeted": false, "possibly_sensitive": false, "lang": "en" }, "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http:\\/\\/abs.twimg.com\\/images\\/themes\\/theme1\\/bg.png", "profile_background_image_url_https": "https:\\/\\/abs.twimg.com\\/images\\/themes\\/theme1\\/bg.png", "profile_background_tile": false, "profile_image_url": "http:\\/\\/pbs.twimg.com\\/profile_images\\/603224208\\/san_face_normal.jpg", "profile_image_url_https": "https:\\/\\/pbs.twimg.com\\/profile_images\\/603224208\\/san_face_normal.jpg", "profile_link_color": "0084B4", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "has_extended_profile": false, "default_profile": true, "default_profile_image": false, "following": false, "follow_request_sent": false, "notifications": false, "muting": false, "blocking": false, "blocked_by": false }, { "id": 281135790, "id_str": "281135790", "name": "manoj bose", "screen_name": "manoj_bose", "location": "", "description": "", "url": null, "entities": { "description": { "urls": [] } }, "protected": false, "followers_count": 3, "friends_count": 10, "listed_count": 0, "created_at": "Tue Apr 12 18:17:41 +0000 2011", "favourites_count": 0, "utc_offset": null, "time_zone": null, "geo_enabled": false, "verified": false, "statuses_count": 2, "lang": "en", "status": { "created_at": "Tue Nov 06 18:22:31 +0000 2012", "id": 265881866744254464, "id_str": "265881866744254464", "text": "Hello", "source": "\Nimbuzz Mobile\<\\/a\>", "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, "geo": null, "coordinates": null, "place": null, "contributors": null, "retweet_count": 0, "favorite_count": 0, "entities": { "hashtags": [], "symbols": [], "user_mentions": [], "urls": [] }, "favorited": false, "retweeted": false, "lang": "en" }, "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http:\\/\\/abs.twimg.com\\/images\\/themes\\/theme1\\/bg.png", "profile_background_image_url_https": "https:\\/\\/abs.twimg.com\\/images\\/themes\\/theme1\\/bg.png", "profile_background_tile": false, "profile_image_url": "http:\\/\\/abs.twimg.com\\/sticky\\/default_profile_images\\/default_profile_5_normal.png", "profile_image_url_https": "https:\\/\\/abs.twimg.com\\/sticky\\/default_profile_images\\/default_profile_5_normal.png", "profile_link_color": "0084B4", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "has_extended_profile": false, "default_profile": true, "default_profile_image": true, "following": false, "follow_request_sent": false, "notifications": false, "muting": false, "blocking": false, "blocked_by": false }, { "id": 3187734769, "id_str": "3187734769", "name": "Parul", "screen_name": "ParulGarg819", "location": "", "description": "", "url": null, "entities": { "description": { "urls": [] } }, "protected": false, "followers_count": 6, "friends_count": 55, "listed_count": 0, "created_at": "Thu May 07 13:03:00 +0000 2015", "favourites_count": 0, "utc_offset": null, "time_zone": null, "geo_enabled": false, "verified": false, "statuses_count": 0, "lang": "en-gb", "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http:\\/\\/abs.twimg.com\\/images\\/themes\\/theme1\\/bg.png", "profile_background_image_url_https": "https:\\/\\/abs.twimg.com\\/images\\/themes\\/theme1\\/bg.png", "profile_background_tile ": false, "profile_image_url ": "http: \\ /\\/pbs.twimg.com\\/profile_images\\/596302789027868672\\/wudduWN7_normal.jpg", "profile_image_url_https": "https:\\/\\/pbs.twimg.com\\/profile_images\\/596302789027868672\\/wudduWN7_normal.jpg", "profile_link_color": "0084B4", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "has_extended_profile": false, "default_profile": true, "default_profile_image": false, "following": false, "follow_request_sent": false, "notifications": false, "muting": false, "blocking": false, "blocked_by": false }], "next_cursor": 1523322916963527611, "next_cursor_str": "1523322916963527611", "previous_cursor": 0, "previous_cursor_str": "0" } 

If you request it for a different user than the user making the authenticated request, then it may have a lot of false values as its follow status is based on the authenticated user. 如果您请求的用户与发出身份验证请求的用户不同,则该请求可能会有很多错误值,因为其遵循状态基于身份验证的用户。

https://api.twitter.com/1.1/friends/list.json?cursor=-1&screen_name=twitterapi&skip_status=true&include_user_entities=false https://api.twitter.com/1.1/friends/list.json?cursor=-1&screen_name=twitterapi&skip_status=true&include_user_entities=false

So for a generic account like twitterapi, most likely you will have a lot of false values, while for a screen_name that follows similar accounts you will have true values. 因此,对于诸如twitterapi之类的通用帐户,很可能您将具有许多错误值,而对于跟随类似帐户的screen_name,您将具有真实值。

Try without specifying screen_name and you should always have true values. 尝试不指定screen_name,并且您应该始终使用true值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM