Reputation: 5478
When I try to list videos with playlistItems.list
, I seem to not be getting the channelId
of the video anywhere. The video owner is different than the playlist owner, mind you.
Here is an example in Google API Explorer
I'm requesting one item from the playlist with an ID of PLgMGySfO8dl_IybGLflF1QhHwhBkOyZg7
. The one item returned is a video with an ID of tDHxiDA1Y6s
. I'm expecting to see the channel with an ID of UCOfEKi7Qkc3g5XNoQSl3D8Q
somewhere, but I don't see it.
I do see UC1bSfMYJEqh7DTSOsbe_t8Q
as a channel ID, but that's the channel ID of the owner of the playlist, not of the video. Also I noticed in the fields editor that there should be a field snippet.resourceId.channelId
, but even if I have it selected to be included, as you can see in the example result below, I do not get any value there.
Is there any way to get the channel IDs included of the videos without a second request?
This is the result I get:
{
"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"
}
}
]
}
Upvotes: 0
Views: 586
Reputation: 2453
They have added the fields 'videoOwnerChannelTitle' and 'videoOwnerChannelId' to the snippet section. Now you can get both values directly in a playlistitems list request.
I just upgraded (using the .NET/C# lib of the Youtube API) from 1.30 to 1.50. Then I got it to work. Had that same issue.
Upvotes: 1
Reputation: 4185
As you suspected, a call to PlaylistItems returns the channel ID of the playlist owner. To get the original channel ID of the videos in the playlist, you'll need a second call to the videos endpoint with the video IDs.
Upvotes: 2