给定Youtube视频的URL或ID,是否可以获得"用户"的(1)名称。谁上传了它和(2)它属于哪个频道?如果是,那么API请求是什么?
所以,例如:let'说我有一个视频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
最后,(作为"方面,辅助问题")我有点困惑,"频道"之间的区别是什么?和#34;用户"。用户可以拥有多个频道吗?我确实在这里阅读了链接:https://www.reddit.com/r/youtube/comments/2vsyit/whats_the_difference_between_user_and_channel/但我正在尝试理解它背后的用例。
干杯
答案 0 :(得分:1)
如果要从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",
最后,(作为“侧面,辅助问题”)我有点困惑是什么 “频道”和“用户”之间的区别。用户可以拥有 多个频道?我确实在这里阅读了链接: https://www.reddit.com/r/youtube/comments/2vsyit/whats_the_difference_between_user_and_channel/ 但我试图理解它背后的用例。
有Google+帐户的链接,请查看https://productforums.google.com/forum/#!topic/youtube/3MsBApaK2Hw