0

_analyticService = new YoutubeAnalyticsService(_authenticator = CreateAuthenticator()); ... var result = _analyticService.Reports.Query("channel==myChannelCode", "2013-01-01", "2013-02-02", "views").Fetch();

I have created a new Youtube analytic Service and I have sent the server a query. My goal is to get the number of views the user has on his videos.

How do I use result to do this?

user1588670
  • 283
  • 1
  • 3
  • 13

1 Answers1

0

In your request

_analyticService.Reports.Query("channel==myChannelCode", "2013-01-01", "2013-02-02", "views").Fetch();

you only fetch the views between 1 January to 2 February. To get the full viewcount you would need to get the lifetime view count, try to specify a start and end date that is far away, like start-date=2005-01-01 and end-date=2100-01-01.

You also probably want to specify a filter with the video id of the video you are looking for, like filter=video==_iwmv6644dA Note also that the view count returned by the api don't seem to get updated as quick as the one on the watch page, so may therefore not be exactly the same.

However, this request works well to get the view count for one of my videos: https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DUCYHMS8hN8s49F93iJuEgG6w&start-date=2005-01-01&end-date=2100-01-01&metrics=views&filters=video%3D%3D_iwmv6644dA&key={YOUR_API_KEY}

Christian
  • 2,426
  • 16
  • 10