YouTube API未在"某些"中显示数据日期范围

时间:2017-01-26 16:51:24

标签: json youtube youtube-api google-oauth

当我将GET请求中的日期更改为YouTube API时,我的问题就开始了。我目前正在尝试使用:

查看喜欢,不喜欢,观看,averageWatchTime和subscriberGained
https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3D{channel_id}&start-date=2017-01-19&end-date=2017-01-26&metrics=likes%2Cdislikes%2CaverageViewDuration%2Cviews%2CsubscribersGained&access_token={access_token}

我得到的JSON响应如下:

{
 "kind": "youtubeAnalytics#resultTable",
 "columnHeaders": [
  {
   "name": "likes",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  },
  {
   "name": "dislikes",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  },
  {
   "name": "averageViewDuration",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  },
  {
   "name": "views",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  },
  {
   "name": "subscribersGained",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  }
 ]
}

但是,如果我使用与上述相同的查询,但将日期设置为几个月前,例如:

https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3D{channel_id}&start-date=2016-08-19&end-date=2017-01-26&metrics=likes%2Cdislikes%2CaverageViewDuration%2Cviews%2CsubscribersGained&access_token={access_token}

我得到相同的JSON,除了包含与我的查询相关的相关信息(实际统计数据)

{
 "kind": "youtubeAnalytics#resultTable",
 "columnHeaders": [
  {
   "name": "likes",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  },
  {
   "name": "dislikes",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  },
  {
   "name": "averageViewDuration",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  },
  {
   "name": "views",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  },
  {
   "name": "subscribersGained",
   "columnType": "METRIC",
   "dataType": "INTEGER"
  }
 ],
 "rows": [
  [
   0.0,
   0.0,
   0.0,
   2.0,
   0.0
  ]
 ]
}

我不确定为什么这不会给我第一个查询的结果。即使数据全是0(如果这是原因)。我试图查看过去一周的频道统计信息,但遗憾的是因为我无法看到它们。

为什么行对象不会出现在第一个查询中,而是出现在第二个查询中?

0 个答案:

没有答案