YouTube API - why number of views is sometimes not available and favorite count is always 0?

StackOverflow https://stackoverflow.com//questions/25057556

  •  21-12-2019
  •  | 
  •  

Question

does anybody know why YouTube API doesn't return view count for some videos?

For example: https://www.youtube.com/watch?v=j46utX3dJlM

This is example request: http://gdata.youtube.com/feeds/api/videos/j46utX3dJlM?alt=json&v=2

And response: https://snap.apigee.com/1rKIcFf (yt$statistics is not available at all)

I thought it's because it's possible to somehow hide stats for a video (http://cl.ly/image/1r033K1Y3N0B), but there are 2 weird things about it: 1) Even the yt$statistics on this video are disabled, I still can get number of likes, dislikes and comments. 2) Some videos, which have stats disabled too, still have the view count in the API. E.G. https://www.youtube.com/watch?v=gkE2-qFeHCE (https://snap.apigee.com/1rKN79a)

And my second question is why favorite count is always 0? No matter which video ID I'll use in the request, the response is always going to contain this:

"yt$statistics":  {
      "favoriteCount": "0",
      "viewCount": "some-number"
}

For example: https://snap.apigee.com/1rKRS2D

I hope there is a simple reason for this. Unfortunately I wasn't able to find any verified answers.

Thanks for your help

Was it helpful?

Solution

  • Fisrt, You use the API YouTube V2, this API is deprecated, you need to use API V3.

    The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. https://developers.google.com/youtube/2.0/developers_guide_protocol_insight

  • To answer your question :

    Even the yt$statistics on this video are disabled, I still can get number of likes, dislikes and comments


    Number of likes, dislikes and comments are public in the video you show up, only the viewCount is private, so no weird things.

    Same for the second video, viewCount is public, you just can't see the stats in the time. So no weird things

  • For the second question, please see the answer for Jeff Posnick

    This data is no longer available for either public requests or requests authenticated as the owner of the video. Sorry to disappoint, but it's working as intended.

    https://stackoverflow.com/a/14858484/2274530

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top