Youtube API playlistId
YouTube API: Get upload playlistID for YouTube ChannelI'm trying to figure out the best way to get a channel's upload playlistID given the channel's channelID. E.g. for the channel with channelID
The corresponding upload playlistID is
Notice the second character has changed from a "C" to a "U" I can do this transformation via string manipulation, but I'm curious if there's a better, less hacky way to find the upload playlist ID through the official youtube api. Here's some Kotlin code that shows my issue: I can find the ChannelID for the "Game Grumps" channel through the following youtube api v3 search: val req = youtube.search().list("snippet"); req.key = {API_KEY} req.q = "Game Grumps" req.type = "channel" val response = req.execute();The resulting Channel id (response.items[0].snippet.channelId) is UC9CuvdOVfMPvKCiwdGKL3cQ But when I run the following to try to get the videos uploaded by the channel, I have to use the transformed ChannelID (starting with UU instead of UC) val req = youtube.PlaylistItems().list("snippet") req.playlistId = "UU9CuvdOVfMPvKCiwdGKL3cQ" req.key = {API_KEY} val response = req .execute()If I use the untransformed "UC" channelID, I get the following error: The playlist identified with the requests playlistId parameter cannot be found. Instead of just replacing the second character with a "U", what's the more robust way (e.g. using the youtube API) of translating a ChannelID to a PlaylistID (for the uploads from that channel)? I would suggest using the official Youtube API, instead of trying to manipulate the strings. You can follow the instructions here: Instructions to get video ids for all uploaded videos for a channel in V3
|