apiyoutubeyoutube-apigdata

Why won't this small change to my YouTube API call work?


In the YouTube API docs I found this example:

https://gdata.youtube.com/feeds/api/videos?q=surfing&max-results=10&fields=entry[yt:statistics/@viewCount>1000000]

Which, of course, works fine.

Now, let's say I wanted to find all the videos that matched surfing, and had more than 1 like (should be quite a lot) - I tried changing it to this:

https://gdata.youtube.com/feeds/api/videos?q=surfing&max-results=10&fields=entry[yt:rating/@numLikes>1]

But it returns nothing.

The docs on yt:rating are here, and I appear to specifying the correct fields. So why am I not getting any results?


Solution

  • Try adding v2 to the URL:

    https://gdata.youtube.com/feeds/api/videos?v=2&q=surfing&max-results=10&fields=entry[yt:rating/@numLikes>10]
    

    The ratings don't appear in the first version of the API