【发布时间】:2014-04-07 02:35:56
【问题描述】:
使用 YouTube API v3 查询频道的品牌设置时,为什么按频道 ID 查询会返回这些信息,而按用户名查询则不会? API 不会按用户名返回频道列表查询的品牌设置。
如果您通过频道 ID(例如,id=UC8-Th83bH_thdKZDJCrn88g)查询频道的品牌设置,则会返回一组完整的品牌设置:
Google API 浏览器:https://developers.google.com/youtube/v3/docs/channels/list
请求
GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&id=UC8-Th83bH_thdKZDJCrn88g&key={YOUR_API_KEY}
回应
{
// ... snip ...
"items": [
{
"kind": "youtube#channel",
"etag": "\"...\"",
"id": "UC8-Th83bH_thdKZDJCrn88g",
"brandingSettings": {
"channel": {
"title": "The Tonight Show Starring Jimmy Fallon",
"description": "Watch The Tonight Show Starring Jimmy Fallon Weeknights 11:35/10:35c\n\nThe Tonight Show Starring Jimmy Fallon features hilarious highlights from the show including: comedy sketches, music parodies, celebrity interviews, ridiculous games, and, of course, Jimmy's Thank You Notes and hashtags! You'll also find behind the scenes videos and other great web exclusives.",
// all the branding settings are here
}
}
}]
}
另一方面,如果您发送频道列表查询以获取用户名(例如,forUsername=latenight),您将获得根本没有品牌设置。不会返回或填充品牌设置。
请求
GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&forUsername=latenight&key={YOUR_API_KEY}
回应
{
// ... snip ...
"items": [
{
"kind": "youtube#channel",
"etag": "\"...\"",
"id": "UC8-Th83bH_thdKZDJCrn88g"
}]
}
【问题讨论】:
标签: youtube youtube-api