youtube-v3-api 频道列表错误
Posted
技术标签:
【中文标题】youtube-v3-api 频道列表错误【英文标题】:youtube-v3-api Channel list error 【发布时间】:2015-12-17 00:33:36 【问题描述】:当我使用页面 https://developers.google.com/youtube/v3/docs/channels/list 上的测试表单来获取我的上传 ID 时,我没有在输出中获得上传 ID 信息。
200 OK
- HIDE HEADERS -
cache-control: private, max-age=0, must-revalidate, no-transform
content-encoding: gzip
content-length: 184
content-type: application/json; charset=UTF-8
date: Sun, 20 Sep 2015 05:09:05 GMT
etag: "jOXstHOM20qemPbHbyzf7ztZ7rI/Z9n3n2b5RwRnE9WNo9TXpCBWbY4"
expires: Sun, 20 Sep 2015 05:09:05 GMT
server: GSE
vary: Origin, X-Origin
"kind": "youtube#channelListResponse",
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/Z9n3n2b5RwRnE9WNo9TXpCBWbY4\"",
"pageInfo":
"totalResults": 0,
"resultsPerPage": 5
,
"items": [
]
用来产生这个请求的命令是
GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=StraconisChannel
让我感到困惑的部分是我正在做与我正在遵循的教程所建议的相同的事情,我唯一要更改的是频道名称并改用我的频道名称。他的输出如下所示:
200 OK
- HIDE HEADERS -
cache-control: private, max-age=0, must-revalidate, no-transform
content-encoding: gzip
content-length: 350
content-type: application/json; charset=UTF-8
date: Sun, 20 Sep 2015 05:15:54 GMT
etag: "jOXstHOM20qemPbHbyzf7ztZ7rI/ih1aNGvKXcChCR4os4iGDwWDjmQ"
expires: Sun, 20 Sep 2015 05:15:54 GMT
server: GSE
vary: Origin, X-Origin
"kind": "youtube#channelListResponse",
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/ih1aNGvKXcChCR4os4iGDwWDjmQ\"",
"pageInfo":
"totalResults": 1,
"resultsPerPage": 5
,
"items": [
"kind": "youtube#channel",
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/vDeq-1ACEYq89nbPsEZtYt0KNW0\"",
"id": "UC29ju8bIPH5as8OGnQzwJyA",
"contentDetails":
"relatedPlaylists":
"likes": "LL29ju8bIPH5as8OGnQzwJyA",
"favorites": "FL29ju8bIPH5as8OGnQzwJyA",
"uploads": "UU29ju8bIPH5as8OGnQzwJyA"
,
"googlePlusUserId": "111890735795696959293"
]
用于他的结果的请求:
GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=techguyweb
我使用 OAuth 2.0 激活了授权,所以我不确定是什么问题。
编辑
因为这是我的 youtube 用户名而不是我的 google plus 帐户名,所以声明了一条评论。我也忘记将其放入提供的信息中。结果是一样的。
200 OK
- HIDE HEADERS -
cache-control: private, max-age=0, must-revalidate, no-transform
content-encoding: gzip
content-length: 184
content-type: application/json; charset=UTF-8
date: Sun, 20 Sep 2015 14:10:14 GMT
etag: "jOXstHOM20qemPbHbyzf7ztZ7rI/Z9n3n2b5RwRnE9WNo9TXpCBWbY4"
expires: Sun, 20 Sep 2015 14:10:14 GMT
server: GSE
vary: Origin, X-Origin
"kind": "youtube#channelListResponse",
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/Z9n3n2b5RwRnE9WNo9TXpCBWbY4\"",
"pageInfo":
"totalResults": 0,
"resultsPerPage": 5
,
"items": [
]
【问题讨论】:
因为这是您的 YouTube 用户名,而不是您的 google+ 帐户名。没什么奇怪的 【参考方案1】:如果您指定通道 ID 而不是通道名称,它将返回正确的响应(我通过 HTTP 请求获取信息,但它应该与您尝试获取响应的方式相同)。
"kind": "youtube#channelListResponse",
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/pZlhvAUywQ74J9YlQvQ1UqIqanc\"",
"pageInfo":
"totalResults": 1,
"resultsPerPage": 1
,
"items": [
"kind": "youtube#channel",
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/iPoXCMXPqVZgATwZUSDCg0QqeCM\"",
"id": "UCoyAhNWQms1nSgGbI3rVebQ",
"snippet":
"title": "StraconisChannel",
"description": "",
"publishedAt": "2015-09-08T22:33:23.000Z",
"thumbnails":
"default":
"url": "https://yt3.ggpht.com/-Yyqu34zJ9zs/AAAAAAAAAAI/AAAAAAAAAAA/tjDa1pW2Smw/s88-c-k-no/photo.jpg"
,
"medium":
"url": "https://yt3.ggpht.com/-Yyqu34zJ9zs/AAAAAAAAAAI/AAAAAAAAAAA/tjDa1pW2Smw/s240-c-k-no/photo.jpg"
,
"high":
"url": "https://yt3.ggpht.com/-Yyqu34zJ9zs/AAAAAAAAAAI/AAAAAAAAAAA/tjDa1pW2Smw/s240-c-k-no/photo.jpg"
,
"localized":
"title": "StraconisChannel",
"description": ""
,
"country": "US"
,
"contentDetails":
"relatedPlaylists":
"uploads": "UUoyAhNWQms1nSgGbI3rVebQ"
,
"googlePlusUserId": "108236998864115482919"
]
确保您已验证您的 YouTube 频道并将您的频道连接到 Google+ 信息页或个人资料。
【讨论】:
以上是关于youtube-v3-api 频道列表错误的主要内容,如果未能解决你的问题,请参考以下文章