-1

I want to fetch the analytics of any channel of youtube that basically are not owned by me. I am using this API. If this is not the right API please suggest me how to achieve this. Also, I am using node. https://youtubeanalytics.googleapis.com/v2/reports?dimensions=day&endDate=2019-01-01&ids=channel%3D%3DUCZSNzBgFub_WWil6TOTYwAg&metrics=likes&startDate=2018-01-01

Response:

 {
 "error": {
  "code": 403,
  "message": "Forbidden",
  "errors": [
   {
    "message": "Forbidden",
    "domain": "global",
    "reason": "forbidden"
   }
  ]
 }
}
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Rahul Saini
  • 216
  • 1
  • 16

1 Answers1

0

You need to understand the difference between private and public data. Public data is data that can be accessed by anyone. Public videos on YouTube for example

Private data is data that is owned by a user. A good example of that would be the analytics for a channel on Youtube. You cant access this kind of information without the permission of the user who owns it.

{
 "error": {
  "code": 403,
  "message": "Forbidden",
  "errors": [
   {
    "message": "Forbidden",
    "domain": "global",
    "reason": "forbidden"
   }
  ]
 }
}

Means that the currently authenticated user doesn't have permission to do what you are trying to do. You need to login with a user who has access to this data. I suggest you ask the owner of the channel to give you access.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • Thanks for the reply. But I want functionality like socialblade website. We can see the analytics of any channel. https://socialblade.com/youtube/channel/UCoEtFc2AuChlV8QnWFN5EMw – Rahul Saini Mar 19 '19 at 04:48
  • Have all the users login with Oauth2 grant you permission to access their data and you will be able to use this api to access their data then. Just because you want to do something does not mean its possible. You need the permission of a user to access their data anything else would be a huge security risk and against everything the term **private data** stands for – Linda Lawton - DaImTo Mar 19 '19 at 07:05
  • Yes, I know the meaning of private data. But socialblade website is showing the analytics of my channel and I never gave them any permissions for my channel. You can check socialblade with any newly made channel which has some analytics data See this(Analytics of my channel): https://socialblade.com/youtube/channel/UCoEtFc2AuChlV8QnWFN5EMw If this is not possible how they are doing? or is there any other way to achieve this? – Rahul Saini Mar 19 '19 at 13:49
  • And socialblade is not reading directly from the YouTube analytics api but preforming its own analytics. Google is not going to let them access your private data without your permission. That would be a major security breach. Yes you can do this preform your own analytics on YouTube channels using the public data available. – Linda Lawton - DaImTo Mar 19 '19 at 13:51