首页 文章

Youtube api v3在上传过程中抛出异常

提问于
浏览
0

使用youtube api v3上传视频:

错误导致上传无法完成 . 该服务youtube引发了异常:Google.GoogleApiException:Google.Apis.Requests.RequestError后端错误[503]错误[消息[后端错误]位置[ - ]原因[backendError]域[全局]]在Microsoft.Runtime.CompilerServices位于Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(任务任务)的Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(任务任务)的.TaskAwaiter.ThrowForNonSuccess(任务任务),位于Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at c:\ code \ google.com \ google-api-dotnet-client \ default \ Tools \ Google.Apis.Release \ bin \ Debug \ test \ default \的Google.Apis.Upload.ResumableUpload1.d__e.MoveNext() Src \ GoogleApis \ Apis [Media] \ Upload \ ResumableUpload.cs:第459行

这个例外 . 我没有它想要的ida . 当我进入调试时它说:

找不到GoogleClientSecrets.cs,然后找不到NewtonsoftJsonSerializer.cs等 .

我已经使用了this code for upload但它有bug ...所以我使用的是:full code in pastebin . 在

var secrets = GoogleClientSecrets.Load(stream).Secrets;

它说无法找到GoogleClientSecrets.cs

enter image description here

我怎么解决这个问题?

一切都没关系 client_secrets.json 我的应用程序已在console.google.com中注册我昨天没有上传但1小时后它抛出此异常.. WTF它需要它吗?

I have tried this但结果相同

1 回答

  • 1

    这个简单的代码可以工作,

    Video newVideo = new Video();
    
    newVideo.Title ="My Test Movie";
    newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
    newVideo.Keywords = "cars, funny";
    newVideo.Description = "My description";
    newVideo.YouTubeEntry.Private = false;
    newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", 
      YouTubeNameTable.DeveloperTagSchema));
    
    newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
    // alternatively, you could just specify a descriptive string
    // newVideo.YouTubeEntry.setYouTubeExtension("location", "Mountain View, CA");
    
    newVideo.YouTubeEntry.MediaSource = new MediaFileSource("c:\\file.mov",
      "video/quicktime");
    Video createdVideo = request.Upload(newVideo);
    

    参考:https://developers.google.com/youtube/2.0/developers_guide_dotnet?csw=1#Direct_Upload

相关问题