Youtube 视频 ID(或 URL)到 "user" 和 "channel"
Youtube video id (or URL) to "user" and "channel"
给定 Youtube 视频的 URL 或 ID,是否可以获取 (1) 上传视频的 "user" 的名称和 (2) 它所属的频道?如果是这样,API 请求是什么?
因此,例如:假设我有一个视频 ID:"VulCl5QfewE" 对应于以下位置的视频:https://www.youtube.com/watch?v=VulCl5QfewE
然后我想提取用户名,即:"TheYoungTurks" 用户的 URL 是:
https://www.youtube.com/user/TheYoungTurks
我还希望能够提取频道名称,即:"UC1yBKRuGpC1tSM73A0ZjYjQ" 频道的 URL 是:
https://www.youtube.com/channel/UC1yBKRuGpC1tSM73A0ZjYjQ
最后,(作为 "side, ancillary question")我有点困惑 "channel" 和 "user" 之间有什么区别。一个用户可以有多个频道吗?我确实在这里阅读了 link:https://www.reddit.com/r/youtube/comments/2vsyit/whats_the_difference_between_user_and_channel/ 但我试图理解它背后的用例。
干杯
如果你想从 videoId 中检索频道信息,你需要使用带有参数的资源videos.list:
part: snippet
id: "VulCl5QfewE" //for example
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=VulCl5QfewE&key={YOUR_API_KEY}
结果显示用户的channelID:
"items": [
{
"kind": "youtube#video",
"etag": "\"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/IcNtD4uunskZTQuIeM0YQRcc5HY\"",
"id": "VulCl5QfewE",
"snippet": {
"publishedAt": "2015-08-05T01:11:24.000Z",
"channelId": "UC1yBKRuGpC1tSM73A0ZjYjQ",
然后使用此信息获取具有资源的频道名称channel.list
part: snippet
id: UC1yBKRuGpC1tSM73A0ZjYjQ
GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id=UC1yBKRuGpC1tSM73A0ZjYjQ&key={YOUR_API_KEY}
部分结果:
"snippet": {
"title": "The Young Turks",
"description": "The Largest Online News Show in the World. Hosted by Cenk Uygur & Ana Kasparian. LIVE weekdays 6-8pm ET. \n\nYoung Turk (n), 1. Young progressive or insurgent member of an institution, movement, or political party. 2. Young person who rebels against authority or societal expectations. (American Heritage Dictionary)\n\nThe Young Turks were the first original talk show on Sirius satellite radio and the first live, daily webcast on the internet. But that is not the revolution.\n\nWe are a rare show that combines all of the news that people care about in one place. We are not afraid to talk about politics and entertainment and sports and pop culture. But that is not the revolution either. \n\nGet The Young Turks\u200b Mobile App Today! \n\nDownload the iOS version here: https://itunes.apple.com/us/app/the-young-turks/id412793195? \n\nDownload the Android version here: https://play.google.com/store/apps/details?id=com.tyt",
"publishedAt": "2005-12-21T20:46:51.000Z",
Finally, (as a "side, ancillary question") I am a bit confused what is
the difference between a "channel" and a "user". Can a user have
multiple channels? I did read the link here:
https://www.reddit.com/r/youtube/comments/2vsyit/whats_the_difference_between_user_and_channel/
but I am trying to understand the use case behind it.
有一个 link 和 Google+ 帐户,查看 https://productforums.google.com/forum/#!topic/youtube/3MsBApaK2Hw
给定 Youtube 视频的 URL 或 ID,是否可以获取 (1) 上传视频的 "user" 的名称和 (2) 它所属的频道?如果是这样,API 请求是什么?
因此,例如:假设我有一个视频 ID:"VulCl5QfewE" 对应于以下位置的视频:https://www.youtube.com/watch?v=VulCl5QfewE
然后我想提取用户名,即:"TheYoungTurks" 用户的 URL 是: https://www.youtube.com/user/TheYoungTurks
我还希望能够提取频道名称,即:"UC1yBKRuGpC1tSM73A0ZjYjQ" 频道的 URL 是:
https://www.youtube.com/channel/UC1yBKRuGpC1tSM73A0ZjYjQ
最后,(作为 "side, ancillary question")我有点困惑 "channel" 和 "user" 之间有什么区别。一个用户可以有多个频道吗?我确实在这里阅读了 link:https://www.reddit.com/r/youtube/comments/2vsyit/whats_the_difference_between_user_and_channel/ 但我试图理解它背后的用例。
干杯
如果你想从 videoId 中检索频道信息,你需要使用带有参数的资源videos.list:
part: snippet
id: "VulCl5QfewE" //for example
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=VulCl5QfewE&key={YOUR_API_KEY}
结果显示用户的channelID:
"items": [
{
"kind": "youtube#video",
"etag": "\"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/IcNtD4uunskZTQuIeM0YQRcc5HY\"",
"id": "VulCl5QfewE",
"snippet": {
"publishedAt": "2015-08-05T01:11:24.000Z",
"channelId": "UC1yBKRuGpC1tSM73A0ZjYjQ",
然后使用此信息获取具有资源的频道名称channel.list
part: snippet
id: UC1yBKRuGpC1tSM73A0ZjYjQ
GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id=UC1yBKRuGpC1tSM73A0ZjYjQ&key={YOUR_API_KEY}
部分结果:
"snippet": {
"title": "The Young Turks",
"description": "The Largest Online News Show in the World. Hosted by Cenk Uygur & Ana Kasparian. LIVE weekdays 6-8pm ET. \n\nYoung Turk (n), 1. Young progressive or insurgent member of an institution, movement, or political party. 2. Young person who rebels against authority or societal expectations. (American Heritage Dictionary)\n\nThe Young Turks were the first original talk show on Sirius satellite radio and the first live, daily webcast on the internet. But that is not the revolution.\n\nWe are a rare show that combines all of the news that people care about in one place. We are not afraid to talk about politics and entertainment and sports and pop culture. But that is not the revolution either. \n\nGet The Young Turks\u200b Mobile App Today! \n\nDownload the iOS version here: https://itunes.apple.com/us/app/the-young-turks/id412793195? \n\nDownload the Android version here: https://play.google.com/store/apps/details?id=com.tyt",
"publishedAt": "2005-12-21T20:46:51.000Z",
Finally, (as a "side, ancillary question") I am a bit confused what is the difference between a "channel" and a "user". Can a user have multiple channels? I did read the link here: https://www.reddit.com/r/youtube/comments/2vsyit/whats_the_difference_between_user_and_channel/ but I am trying to understand the use case behind it.
有一个 link 和 Google+ 帐户,查看 https://productforums.google.com/forum/#!topic/youtube/3MsBApaK2Hw