過去兩天,我一直在嘗試從我的網站上傳視頻到YouTube。 VB沒有文檔,也沒有太多的.Net工作例子。將視頻上傳到youTube,第1步YouTube Data API 3獲取UserCredential?
我正在尋找以任何方式將視頻上傳到YouTube。我嘗試過YouTube Data API 3和YouTube Data API 2,但沒有成功。
繼YouTube的API我試圖讓我的UserCredentials https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video
我創建了一個OAuth鍵值和谷歌的控制檯上的公共API密鑰。 https://console.developers.google.com/project
UserCredential credential;
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
// This OAuth 2.0 access scope allows for full read/write access to the
// authenticated user's account.
new[] { YouTubeService.Scope.Youtube },
"user",
CancellationToken.None,
new FileDataStore(this.GetType().ToString())
);
}
如果有人得到這上面的部分工作或知道一個地方,我可以看到如何得到它的工作將非常感激。
我在YouTube數據API 3的嘗試我必須使用VB,但會接受C#中的答案,因爲我可以將其轉換,任何有效的UserCredentials示例都將是一個可接受的答案。
兩個問題的第一個是我需要這個在VB中。 我在()下面有一條藍色的線。
Using stream = New FileStream("client_secrets.json", FileMode.Open, FileAccess.Read)
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, New() {YouTubeService.Scope.YoutubeReadonly}, "user", CancellationToken.None, New FileDataStore(Me.[GetType]().ToString()))
End Using
第二個問題是我不知道應該進入「的client_secrets.json」
我在YouTube數據API 2嘗試: Upload video to YouTube, Execution of request failed, (401) Unauthorized
我想我已經得到了的client_secrets.json。 – Pomster 2014-10-01 15:39:57