我需要使用C#控制台程序下载“ youtube Analytics”数据,以下是用于下载数据的代码。这里的 “Reports.Query()。执行()” 被抛出异常。
Errors [
Message[Required] Location[ - ] Reason[required] Domain[global]
]
在以下
有人可以请帮助私有静态无效GetYoutubeAnalytics() {
string[] scopes = { YouTubeReportingService.Scope.YtAnalyticsReadonly, YouTubeReportingService.Scope.YtAnalyticsMonetaryReadonly }; //Read-only access to Google Analytics
GoogleCredential credential;
using (FileStream stream = new FileStream("YoutubeAnalytics-ac2d31ec7846.json", FileMode.Open, FileAccess.Read))
{
credential = GoogleCredential.FromStream(stream).CreateScoped(scopes);
}
YouTubeAnalyticsService _service = new YouTubeAnalyticsService(new BaseClientService.Initializer()
{
ApplicationName="KI Youtube Extractor",
HttpClientInitializer=credential
});
Google.Apis.YouTubeAnalytics.v2.Data.QueryResponse r = _service.Reports.Query().Execute();
}