javascriptyoutubeyoutube-javascript-api

Youtube api unknown part statistics


I am trying to get the part of statistics and for some reason i am getting error and i do like the docs say.

This is what i am sending:

https://www.googleapis.com/youtube/v3/search?key=AIzaSyBsobUXzJvjjuHZsMiv7SZAkzVcSgc8F2c&maxResults=5&part=id,snippet,statistics&q=test

without the statistics part this is working.

{
 "error": {
  "errors": [
   {
    "domain": "youtube.part",
    "reason": "unknownPart",
    "message": "statistics",
    "locationType": "parameter",
    "location": "part"
   }
  ],
  "code": 400,
  "message": "statistics"
 }
}

Solution

  • You need to get the video id in this call and then send a new get request with statistics part to this url:

    https://www.googleapis.com/youtube/v3/videos?id=videoId&part=statistics