Search YouTube videos by author
1 answer
In the YouTube Data API v3 you need to find UploadsPlaylist from a custom channel and they look for PlaylistItems for that channel.
So, for example, if you want to find GoogleDevelopers downloads, first find their channel_id.
If you don't know the user channel_id, you must call the search resource (with the type set to "channel") to find it:
Return:
{
"kind": "youtube#searchListResponse",
"etag": "\"Sja0zsjNVqBAv0D_Jpz6t1GyTzk/fm4P2RLxOAO0xdASI5BagD86H8A\"",
"pageInfo": {
"totalResults": 21,
"resultsPerPage": 1
},
"nextPageToken": "CAEQAA",
"items": [
{
"id": {
"kind": "youtube#channel",
"channelId": "UC_x5XG1OV2P6uZZ5FSM9Ttw"
},
"kind": "youtube#searchResult",
"etag": "\"Sja0zsjNVqBAv0D_Jpz6t1GyTzk/q4hYefapiMoagc7b_3bYaVZvSJo\""
}
]
}
As you can see their channelId = UC_x5XG1OV2P6uZZ5FSM9Ttw
Make a call to the content portion of the channel resource to find their playlist:
Which will return this:
{
"kind": "youtube#channelListResponse",
"etag": "\"Sja0zsjNVqBAv0D_Jpz6t1GyTzk/ZouMU1qBRkF6DgacOLHE88Xk144\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"id": "UC_x5XG1OV2P6uZZ5FSM9Ttw",
"kind": "youtube#channel",
"etag": "\"Sja0zsjNVqBAv0D_Jpz6t1GyTzk/khrrkvk8Tl0XWRZoN66zqloSJM4\"",
"contentDetails": {
"relatedPlaylists": {
"uploads": "UU_x5XG1OV2P6uZZ5FSM9Ttw"
}
}
}
]
}
As you can see their playlist ID is UU_x5XG1OV2P6uZZ5FSM9Ttw
Make a call to the PlaylistItems resource to get the videos uploaded by GoogleDevelopers:
+5
source to share