0
votes

Some of the channels giving zero videos result even though there are existing videos on those channels. But on some channels it's working fine.

Here is the channel example which is not returning result.

channel id: UCsmyfPVdui2ZjOQSdM6CHWA

My question is, is youtube API v3 not returning result from inactive channels? Or what is the reason(s) behind this? Thank you so much in advance.

Tried to read youtube API docs. but can't find relating to this issue.

Here is the curl I'm using: https://www.googleapis.com/youtube/v3/search?key=&channelId=UCsmyfPVdui2ZjOQSdM6CHWA&part=snippet,id&order=date&maxResults=50&pageToken=CDIQAA

NOTE: This is working fine on some channels and not working on some channels too.

1

1 Answers

0
votes

Can't say for sure why the search request is not working with some channels, but, you can try get the uploaded videos from given channel by using the "youtube.playlistItems.list" request.

Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs.

Here is an example (using the channel_id you provided in your question):

https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails%2Cstatus&playlistId=UUsmyfPVdui2ZjOQSdM6CHWA&fields=items(contentDetails%2FvideoId%2Csnippet(position%2Cthumbnails%2Ctitle)%2Cstatus)&key={YOUR_API_KEY}

In this request, I'm using the uploads playlist id for retrieve the uploaded videos from a given channel_id - you can check my answer for more information.

Here is the Google API Explorer demo where you can test futher.