George Olah
George Olah

Reputation: 607

Search in Youtube API by videoCategoryId

I am trying to run the following call of the Youtube search API:

GET https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=10&order=relevance&relatedToVideoId=_CgRVkydY6Q&type=video&videoCategoryId=2&key={YOUR_API_KEY}

It returns 10 results, but some of them are not in category 2. For example, it gave me a result (ID: TG5e9Px3h-M) with videoCategoryId 22. I assume it does the search in the category ID with LIKE, not exact match.

How can I make this search with exact match for videoCategoryId?

Upvotes: 0

Views: 636

Answers (1)

Kumar
Kumar

Reputation: 1217

I think you cannot use relatedToVideoId and videoCategoryId at same time. Related videos list for a particular video is fixed in youtube. I have tried with 1,10,22,33,32 and 44 category id. But I got same result has I do not give videoCategoryId parameter. videoCategoryId is works when you search keyword and just give type parameter in api url.

Upvotes: 1

Related Questions