本文介绍了C# 中的 YouTube API 视频上传解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过 C# 中的 API(而不是通过客户端)将视频(可恢复)上传到 YouTube.
I'm trying to upload a video (resumable) to YouTube via the API in C# (not through client).
我正在遵循这些关于使用可恢复上传协议的说明
然而,当我尝试时,我得到一个解析错误.
However when I make the attempt I get back an Parse Error.
这是我的要求:
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"
}
}
有人有什么想法吗?
推荐答案
解析错误是由于True用大T写的.
The parse error is due to True being written with a big T.
(使用 beta 库不是我的选择,因为 Unity..NET 2.0..)
(using the beta library is not an option for me becuase of Unity. .NET 2.0..)
这篇关于C# 中的 YouTube API 视频上传解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!