如何使用 youtube v3 API 知道视频的上传者?
How to know uploader of a video using youtube v3 API?
我想检索已上传视频的用户的姓名。我可以使用 this link 但视频的上传者来检索视频长度、标题、描述等信息。任何帮助将不胜感激。
提前致谢。
如果您查询这样的视频:https://www.googleapis.com/youtube/v3/videos?part=snippet&id=j4ovbmsp6p0&key={YOUR_API_KEY}
你会得到这样的结果:
{
"kind": "youtube#videoListResponse",
"etag": "\"4FSIjSQU83ZJMYAO0IqRYMvZX98/2gSGwmuY674XAGNAXoSrDENmJPo\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"4FSIjSQU83ZJMYAO0IqRYMvZX98/ai8sU-I-pLgfr5cd4lRv2KdntL4\"",
"id": "j4ovbmsp6p0",
"snippet": {
"publishedAt": "2014-07-11T11:41:11.000Z",
"channelId": "UCF7OtvI5wVzb5Jl74nI3Mkg",
"title": "Woohoo!! I daut it!! #idautit - Das Originale WhatsApp Video - #Idautit Idauit idaudit",
"description": "Das Originale I daut it Video #idautit. Der Sommertrend, bekannt geworden durch das virale WhatsApp Video. #idautit",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "Idautit Official",
"categoryId": "22",
"liveBroadcastContent": "none",
"localized": {
"title": "Woohoo!! I daut it!! #idautit - Das Originale WhatsApp Video - #Idautit Idauit idaudit",
"description": "Das Originale I daut it Video #idautit. Der Sommertrend, bekannt geworden durch das virale WhatsApp Video. #idautit"
}
}
}
]
}
上传用户始终是频道本身。因此,您只需要使用属性 "channelTitle" 或 "channelId" 进行进一步查找。
在这里你可以找到一些详细的信息:https://developers.google.com/youtube/v3/migration-guide#channels
上面写着:
Whereas the v2 API provided a way for retrieving a user's profile, the
v3 API provides a method for retrieving information about a channel.
There are several differences between the two implementations: [...]
我想检索已上传视频的用户的姓名。我可以使用 this link 但视频的上传者来检索视频长度、标题、描述等信息。任何帮助将不胜感激。
提前致谢。
如果您查询这样的视频:https://www.googleapis.com/youtube/v3/videos?part=snippet&id=j4ovbmsp6p0&key={YOUR_API_KEY}
你会得到这样的结果:
{
"kind": "youtube#videoListResponse",
"etag": "\"4FSIjSQU83ZJMYAO0IqRYMvZX98/2gSGwmuY674XAGNAXoSrDENmJPo\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"4FSIjSQU83ZJMYAO0IqRYMvZX98/ai8sU-I-pLgfr5cd4lRv2KdntL4\"",
"id": "j4ovbmsp6p0",
"snippet": {
"publishedAt": "2014-07-11T11:41:11.000Z",
"channelId": "UCF7OtvI5wVzb5Jl74nI3Mkg",
"title": "Woohoo!! I daut it!! #idautit - Das Originale WhatsApp Video - #Idautit Idauit idaudit",
"description": "Das Originale I daut it Video #idautit. Der Sommertrend, bekannt geworden durch das virale WhatsApp Video. #idautit",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/j4ovbmsp6p0/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "Idautit Official",
"categoryId": "22",
"liveBroadcastContent": "none",
"localized": {
"title": "Woohoo!! I daut it!! #idautit - Das Originale WhatsApp Video - #Idautit Idauit idaudit",
"description": "Das Originale I daut it Video #idautit. Der Sommertrend, bekannt geworden durch das virale WhatsApp Video. #idautit"
}
}
}
]
}
上传用户始终是频道本身。因此,您只需要使用属性 "channelTitle" 或 "channelId" 进行进一步查找。
在这里你可以找到一些详细的信息:https://developers.google.com/youtube/v3/migration-guide#channels
上面写着:
Whereas the v2 API provided a way for retrieving a user's profile, the v3 API provides a method for retrieving information about a channel. There are several differences between the two implementations: [...]