Reputation: 173
I am using YouTube Data API Version 3.0 in one of my projects to fetch my channel video details from YouTube. I don't want the user to login to his/her Google account that's why I am directly using Search.list method instead of going through the OAuth 2.0 way.
Usually I fetch data using following URL.
https://www.googleapis.com/youtube/v3/search?key={API_KEY}&maxResults=5&part=snippet&type=video&channelId={CHANNEL_ID}
Now, I want to fetch data of 5 different categories at a time. What I can do is, hit the same URL 5 times with query string as
key={API_KEY}&maxResults=1&part=snippet&type=video&channelId={CHANNEL_ID}&videoCategoryId={CATEGORY_ID}
or,
Is there a way like
key={API_KEY}&maxResults=5&part=snippet&type=video&channelId={CHANNEL_ID}&videoCategoryId={CATEGORY_ID_1, CATEGORY_ID_2, CATEGORY_ID_3, CATEGORY_ID_4, CATEGORY_ID_5}
I want to fetch only 1 video data per category. That is why I have given 5 comma separated category IDs.
Also, Search.list method does not give videoCategoryId. To get it, I have to use
https://www.googleapis.com/youtube/v3/videos?part=snippet&id={VIDEO_ID}&key={API_KEY}
Is there any way to get videoCategoryId in Search.list method?
Upvotes: 1
Views: 1785
Reputation: 12877
Upvotes: 3