0

我正在尝试通过 C# 中的 API(而不是通过客户端)将视频(可恢复)上传到 YouTube。

我正在按照这些说明使用可恢复上传协议

但是,当我尝试时,我得到了一个解析错误。

这是我的要求:


POST /upload/youtube/v3/videos?uploadType=resumable&part=snippet,status,contentDetails&key={api_key} HTTP/1.1
Host: www.googleapis.com
X-upload-content-length: 5346742
X-upload-content-type: video/*
Content-type: application/json; charset=UTF-8
Content-length: 277
Authorization: Bearer {access_token}

{
  "snippet": {
    "title": "My video title",
    "description": "This is a description of my video",
    "tags": ["cool", "video", "more keywords"],
    "categoryId": 22
  },
  "status": {
    "privacyStatus": "public",
    "embeddable": True,
    "license": "youtube"
  }
}

这是回应:


HTTP/1.1 400 Bad Request
Alternate-protocol: 443:quic
Content-length: 171
Via: HTTP/1.1 GWA
X-google-cache-control: remote-fetch
Server: HTTP Upload Server Built on Sep 30 2013 10:58:35 (1380563915)
Date: Wed, 02 Oct 2013 21:38:10 GMT
Content-type: application/json

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "parseError",
    "message": "Parse Error"
   }
  ],
  "code": 400,
  "message": "Parse Error"
 }
}

有人有想法么?

4

2 回答 2

1

解析错误是由于True是用大 T 编写的。

(使用 beta 库对我来说不是一个选项,因为 Unity..NET 2.0 ..)

于 2013-10-16T12:29:07.873 回答
0

为什么不使用 Google GData Youtube Api for .NET?

        string developerkey = "developerKey";
        YouTubeRequestSettings settings = new YouTubeRequestSettings("Somethinghere", developerkey, "googleUserName", "googlePassWord");
        YouTubeRequest request = new YouTubeRequest(settings);

        newVideo.Title = "Video Title Here || ArgeKumandan";
        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));
        // alternatively, you could just specify a descriptive string
        // newVideo.YouTubeEntry.setYouTubeExtension("location", "Mountain View, CA");

        newVideo.YouTubeEntry.MediaSource = new MediaFileSource(@"D:\video ArgeKumandan.flv", "video/flv");

        createdVideo  = request.Upload(newVideo);
于 2013-10-02T23:46:53.330 回答