当我尝试使用playlistItems.list
列出视频时,我似乎无法在任何地方获取视频的channelId
。请注意,视频所有者与播放列表所有者不同。
Here is an example in Google API Explorer
我正在从播放列表中请求一个ID为PLgMGySfO8dl_IybGLflF1QhHwhBkOyZg7
的项目。返回的一项是ID为tDHxiDA1Y6s
的视频。我希望在某个地方看到ID为UCOfEKi7Qkc3g5XNoQSl3D8Q
的频道,但看不到。
我确实将UC1bSfMYJEqh7DTSOsbe_t8Q
视为频道ID,但这是播放列表(而非视频)所有者的频道ID。我还注意到在字段编辑器中应该有一个字段snippet.resourceId.channelId
,但是即使选择了要包含的字段,如下面的示例结果所示,我也没有得到任何值。>
有没有其他方法可以获取视频中包含的频道ID?
这是我得到的结果:
{
"kind": "youtube#playlistItemListResponse",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/rEUHufzTzfkJMLVrD2pBtEz5OWY\"",
"nextPageToken": "CAEQAA",
"pageInfo": {
"totalResults": 30,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#playlistItem",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/2VurTVExuTlDwFHQ3ULfjL-KM7U\"",
"id": "UExnTUd5U2ZPOGRsX0l5YkdMZmxGMVFoSHdoQmtPeVpnNy41NkI0NEY2RDEwNTU3Q0M2",
"snippet": {
"publishedAt": "2018-05-26T11:37:02.000Z",
"channelId": "UC1bSfMYJEqh7DTSOsbe_t8Q",
"title": "Unreal Tournament - Soundtrack (UMX)",
"description": "Music by Alexander \"Siren\" Brandon and Michiel van den Bos.\n\"enigma\", \"seeker\", \"seeker2\" by Daniel \"Basehead\" Gardopée.\n\"FireBreath\" by Tero \"Teque\" Kostermaa and Kaj-Eerik \"Nitro\" Komppa.\n\"mechanism eight\" by Andrew \"Necros\" Sega.\n\"Razorback // Unreal mix\" by Peter \"Skaven\" Hajba.\n\nTracks:\n00:00 BOTPACK #9(By Michiel)\n04:51 BOTMCA#10 (By Michiel)\n09:13 Cannonade\n11:11 Colossus (Michiel)\n15:30 The Course\n20:01 Room of Champions\n22:17 Shared Dig\n28:03 Into the darkness (Ending.umx)\n29:53 unreal add-on (enigma)\n33:19 -xTREMELY xECUTABLE-\n35:31 FireBreath\n38:48 Foregone Destruction\n43:02 Go Down\n46:05 Guardian\n47:50 Nightvision - Sandman/KFM\n51:58 Lock\n54:44 mechanism eight - necros\n1:01:38 Mission Landing\n1:05:53 Nether Animal\n1:10:56 Organic\n1:14:01 Phantom\n1:20:04 Razorback // Unreal mix\n1:24:56 RipCord\n1:27:08 Riverb3\n1:29:05 Run\n1:33:41 Dream Tear Down\n1:38:54 Save Me (SaveMe.umx)\n1:40:47 Save Me (Savemeg.umx)\n1:42:41 unreal add-on (seeker)\n1:46:34 unreal add-on (seeker2)\n1:50:01 Skyward Fire\n1:55:00 Into the darkness (Strider.umx)\n1:57:45 Submarinebase 2\n2:01:51 SuperFist\n2:03:51 Underworld II\n2:07:02 Unreal Tournament Menu\n2:09:04 Unreal Tournament Title\n2:10:33 Three Wheels Turning\n\nA few titles and credits information taken from the Liandri Archives.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/tDHxiDA1Y6s/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/tDHxiDA1Y6s/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/tDHxiDA1Y6s/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/tDHxiDA1Y6s/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/tDHxiDA1Y6s/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "amcsi",
"playlistId": "PLgMGySfO8dl_IybGLflF1QhHwhBkOyZg7",
"position": 0,
"resourceId": {
"kind": "youtube#video",
"videoId": "tDHxiDA1Y6s"
}
},
"contentDetails": {
"videoId": "tDHxiDA1Y6s",
"videoPublishedAt": "2011-05-02T19:50:49.000Z"
}
}
]
}
答案 0 :(得分:2)
您怀疑,对PlaylistItems的调用会返回播放列表所有者的频道ID。要获取播放列表中视频的原始频道ID,您需要再次调用带有视频ID的视频端点。
答案 1 :(得分:0)
他们已将字段“videoOwnerChannelTitle”和“videoOwnerChannelId”添加到代码段部分。 现在您可以直接在 playlistitems 列表请求中获取这两个值。
我刚刚将(使用 Youtube API 的 .NET/C# 库)从 1.30 升级到 1.50。 然后我让它工作。有同样的问题。