Fetching shorts videos for the channel - anshulupadhyay03/mytube GitHub Wiki
Details
Under every subscription data that you got from :Page here you can get the channelID of the channels under resource like below
"resourceId": { "kind": "youtube#channel", "channelId": "UCAmesXXoaHPLXJ0Ol9vEE9A" },
Now so we you try to check the https://www.youtube.com/channel/UCAmesXXoaHPLXJ0Ol9vEE9A you will see your channel
Now to get the short videos on this channel you have just to replace the UC in the channel ID to UUSH https://www.youtube.com/playlist?list=UUSHAmesXXoaHPLXJ0Ol9vEE9A
NOTE: Some channels don't have short videos you get an error from API which you have to handle.
Now the Api details
first you have to call the playlist items API https://developers.google.com/youtube/v3/docs/playlistItems/list
Request :
part: contentDetails
playlistId : UUSHAmesXXoaHPLXJ0Ol9vEE9A
Response :
{
"kind": "youtube#playlistItemListResponse",
"etag": "MSn-5LnPsyri1zR0JKKifV605vY",
"nextPageToken": "EAAaf1BUOkNBVWlFREV5UlVaQ00wSXhRelUzUkVVMFJURW9BVWpkb3Q3a2hkMkZBMUFCV2pvaVEyaHdWbFpXVGtsUlZ6RnNZekZvV1dJeVJrbFZSWGhaVTJwQ1VHSkViREpTVlZVMVVWSkpUVU5QTTBOeFRFVkhSVTFwYVRrM1owUWk",
"items": [
{
"kind": "youtube#playlistItem",
"etag": "Ygt-UlzqlRdISe6kbyXCrqfOIrs",
"id": "VVVTSEFtZXNYWG9hSFBMWEowT2w5dkVFOUEuRHlzYjRTMndkNzA",
"contentDetails": {
"videoId": "Dysb4S2wd70",
"videoPublishedAt": "2024-04-23T16:41:05Z"
}
},
{
"kind": "youtube#playlistItem",
"etag": "OLQEKS6Eijq-Dn650fbyx4nv59M",
"id": "VVVTSEFtZXNYWG9hSFBMWEowT2w5dkVFOUEuNFo1RHZKcVVCRGc",
"contentDetails": {
"videoId": "4Z5DvJqUBDg",
"videoPublishedAt": "2024-04-23T07:00:03Z"
}
},
{
"kind": "youtube#playlistItem",
"etag": "7uoYjRk61xWSVvtz-FIPJTqOR3I",
"id": "VVVTSEFtZXNYWG9hSFBMWEowT2w5dkVFOUEuVTBfaEs0NlZSdnc",
"contentDetails": {
"videoId": "U0_hK46VRvw",
"videoPublishedAt": "2024-04-21T07:00:12Z"
}
},
{
"kind": "youtube#playlistItem",
"etag": "Qg-C6nOzoJx3CG1FFJG9zlPIDcs",
"id": "VVVTSEFtZXNYWG9hSFBMWEowT2w5dkVFOUEuSEk2aFk0YUttYk0",
"contentDetails": {
"videoId": "HI6hY4aKmbM",
"videoPublishedAt": "2024-04-18T07:00:13Z"
}
},
{
"kind": "youtube#playlistItem",
"etag": "TH3aqUe7qgZx1Atipi760qSH03o",
"id": "VVVTSEFtZXNYWG9hSFBMWEowT2w5dkVFOUEuOUh4YWU3b3h3YXM",
"contentDetails": {
"videoId": "9Hxae7oxwas",
"videoPublishedAt": "2024-04-16T14:46:04Z"
}
}
],
"pageInfo": {
"totalResults": 148,
"resultsPerPage": 5
}
}