我有一些 .net 代码会产生以下帖子(从提琴手复制的原始数据,二进制数据被截断)但是每次发送请求时我都会收到 400 错误请求
POST http://uploads.gdata.youtube.com/feeds/api/users/default/uploads HTTP/1.1
Authorization: OAuth ya29.AHES6ZTq4wOyYah1NRGrelvmg8icDsKwjkZuhN_IOdgDX75-
GData-Version: 2
X-GData-Key: key=..apikey...
Slug: sample.AVI
Content-Type: multipart/related; boundary="dsjdwdjd3"
Host: uploads.gdata.youtube.com
Content-Length: 1980444
Expect: 100-continue
Connection: Close
--dsjdwdjd3
Content-Type: application/atom+xml; charset=UTF-8
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
<media:title type="plain">testVideo1</media:title>
<media:description type="plain">this is a test video1</media:description>
<media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People</media:category>
<media:keywords>test1</media:keywords>
</media:group>
</entry>
--dsjdwdjd3
Content-Type: video/avi
Content-Transfer-Encoding: binary
RIFF�4�AVI LIST&....... truncated binary....
--dsjdwdjd3
这是 POST 上的谷歌文档,但据我所知,它与https://developers.google.com/youtube/2.0/developers_guide_protocol_direct_uploading完全相同。
我背后的代码是将其作为 httpwebrequest 发送,并且据我所知。
编辑:我不认为这是身份验证或开发人员密钥问题,因为我故意输入了不正确的详细信息,并且返回 401 无效令牌或无效开发人员密钥。
编辑 2:完整的响应,从提琴手以原始格式粘贴
HTTP/1.1 400 Bad Request
Server: HTTP Upload Server Built on Apr 10 2012 14:42:33 (1334094153)
Content-Type: text/html; charset=UTF-8
X-GUploader-UploadID: AEnB2Up2iQ676IS9KRGmvmdbgBFGZLwLXHmnSv3cTUu-1TAHbuylsLncHOK0Q0MBSg22ZaGQ8aQ3JQps5bmAJ9xaYtYq1jNI_Q
Date: Mon, 16 Apr 2012 10:11:10 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 15
Connection: close
Invalid Request