2

当设置参数 mySubscribers=true 时,YouTube API v3 会为所有频道列表查询返回 0 的订阅者计数值。如果我使用替代的“channelId”或“mine”参数,subscriberCount 是准确的。

以下是对文档的参考: https ://developers.google.com/youtube/v3/docs/channels/list

为了简单起见,我将部分设置为 id 和 statistics 以获取频道信息。这是(测试版)API 的错误吗?

4

3 回答 3

0

I has the same problem, right now for this metric you can use YouTube Data API v2, like this:

http://gdata.youtube.com/feeds/api/users/{USER-ID-OR-USERNAME}?v=2&alt=json

And get this metric from yt$statistics->subscriberCount

于 2013-02-05T07:57:19.490 回答
0

它对我有用。你在认证吗?如果你设置了 mySubscribers=true 而没有设置 mine=true(如果两者都设置为 true,你会得到一个错误),你应该得到一个列表。在该列表中应该是 pageInfo -> totalResults,它应该告诉您数字。

以下是来自 API Explorer ( https://developers.google.com/youtube/v3/docs/channels/list#try-it )的正确调用示例:

获取https://www.googleapis.com/youtube/v3/channels?part=id%2Cstatistics&mySubscribers=true&key= {YOUR_API_KEY}

授权:承载 ya29.blahblah X-JavaScript-User-Agent:Google APIs Explorer

于 2013-02-21T06:48:50.457 回答
0
Get Subscribers count by following way using V3 api     
    URLString =[NSString stringWithFormat:@"https://www.googleapis.com/youtube/v3/channels?part=id&mySubscribers=true&access_token=%@",accessToken]    

        Response

         etag = "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/0_NpYsUUR0M4UrddABQ5GlAx0aA\"";
                items =     (
                            {
                        etag = "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/I5mDLVKzrHCsmda5ZyJOe_6dhQ0\"";
                        id = uhjUCDMMDlm9PwDGiMdfV7QeIRgasd;
                        kind = "youtube#channel";
                    },
                            {
                        etag = "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/kUNuk7bhfC8iuWaAUvnBzbv3ZdM\"";
                        id = hjvhUCdMacPC0kNs1h3O1amJ2Mdwnv;
                        kind = "youtube#channel";
                    }
                );
                kind = "youtube#channelListResponse";
                pageInfo =     {
                    resultsPerPage = 5;
                    totalResults = 3;   ////// Subscribers Count
                };
            }
于 2015-08-22T12:21:06.727 回答