Yozer
Yozer

Reputation: 648

YouTube API search by keywords and category id

I'm trying to search videos by category id and keywords.

Here is my link:

https://www.googleapis.com/youtube/v3/search?part=snippet&key=API_KEYs&videoCategoryId=10&q=bieber

I'm getting:

{
 "error": {
  "errors": [
   {
    "domain": "youtube.search",
    "reason": "invalidSearchFilter",
    "message": "Invalid combination of search filters and/or restrictions.",
    "locationType": "parameter",
    "location": ""
   }
  ],
  "code": 400,
  "message": "Invalid combination of search filters and/or restrictions."
 }
}

What i should change in my api request?

Upvotes: 2

Views: 2144

Answers (1)

Ibrahim Ulukaya
Ibrahim Ulukaya

Reputation: 12877

Data API has a unified search, meaning, search returns videos, playlists and channels. To filter by video specific parameters like videoCategoryId, you have to define "type=video"

https://www.googleapis.com/youtube/v3/search?part=snippet&q=bieber&type=video&videoCategoryId=10&key={YOUR_API_KEY}

Upvotes: 6

Related Questions