在 get friends/list API Twitter 中,“following”键总是 returns false

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

当我使用 Twitter 的 GET friends/list API 测试我的应用程序时,JSON 的 "following" 键总是变成 false/null 甚至如果用户关注我。为什么这种情况不断发生?

样本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": "\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e",
      "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": "\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\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,
      "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": "\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\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,
        "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": "\u003ca href=\"http:\/\/www.nimbuzz.com\" rel=\"nofollow\"\u003eNimbuzz Mobile\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,
      "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"
}

如果您为与发出经过身份验证请求的用户不同的用户请求它,那么它可能有很多错误值,因为它的跟随状态基于经过身份验证的用户。

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

因此,对于像 twitterapi 这样的通用帐户,您很可能会有很多错误值,而对于遵循类似帐户的 screen_name,您将有真实值。

在不指定 screen_name 的情况下尝试,您应该始终拥有真实的值。