は、私は私のWPFのプロジェクトに公式NuGetパッケージを追加したYouTubeのAPIのv3のYoutube APIを使用してライブビデオのリストを見つける方法は?
を使用して、任意のチャンネルからライブイベントのリストを取得する必要があります。
Google.Apis.Auth.OAuth2を使用して、 Google.Apis.Servicesを使用しています。 Google.Apis.Util.Storeを使用しています。 Google.Apis.YouTube.v3を使用しています。
と私は、ボタンのクリックでOAuth認証を追加しました:私はしようとしています
その後
UserCredential credential;
using (var stream = new FileStream("mydowloadedjsonfile.json", FileMode.Open, FileAccess.Read))
{
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets, new[] { YouTubeService.Scope.YoutubeReadonly }, "user",
CancellationToken.None, new FileDataStore("YouTubeAPI")
).Result;
}
var service = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "YouTubeAPI"
});
このコードは素晴らしい作品が、それは私のユーザーにユーチューブの権限を認証され、許可を取得するためにブラウザを開きますライブイベントのリストを取得するが、私はfaillingています:
var request = service.Search.List("snippet");
request.Q = "live event";//I know this is wrong...
request.MaxResults = 10;
var response = request.Execute();
Obliviouslyを、私はそれが間違ってやっている、誰かが正しい方向を指し示すことができますか?