尝试使用Java客户端/ api上传到YouTube时出错。我有一段时间没有测试过,但它确实有效,所以我不确定是什么导致它停止。
据我所知,一切看起来都不错,但是当我尝试上传新视频时,YouTube会不断响应“缺少开始边界”。
我真的不知道是什么原因引起的。我最终通过代理来捕获这些信息,希望它有助于弄清楚我为什么会这样做。
请求......
POST /feeds/api/users/default/uploads HTTP/1.1
Content-Type: multipart/related;boundary="----=_Part_2_1952419521.1368370735234"
Authorization: GoogleLogin auth=<removed>
User-Agent: service-test YouTube-Java/1.0 GData-Java/1.47.1(gzip)
X-GData-Key: key=<removed>
X-GData-Client: service-test
Slug: Screen.Recording.m4v
Accept-Encoding: gzip
GData-Version: 2.0
Cache-Control: no-cache
Pragma: no-cache
Host: gdata.youtube.com
Accept: text/html, image/gif, image/jpeg, *; q=.2
Transfer-Encoding: chunked
------=_Part_2_1952419521.1368370735234
Content-Type: application/atom+xml
<?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss' xmlns:media='http://search.yahoo.com/mrss/' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:yt='http://gdata.youtube.com/schemas/2007' xmlns:gd='http://schemas.google.com/g/2005'><app:control xmlns:app='http://www.w3.org/2007/app'><app:draft>yes</app:draft><yt:incomplete/></app:control><atom:category xmlns:atom='http://www.w3.org/2005/Atom' scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/><atom:content xmlns:atom='http://www.w3.org/2005/Atom' type='video/mp4'/><media:group><media:title type='plain'>Screen.Recording.m4v</media:title></media:group><yt:accessControl permission='denied' action='list'/></entry>
------=_Part_2_1952419521.1368370735234
Content-Type: video/mp4
<removed video content>
------=_Part_2_1952419521.1368370735234--
响应......
HTTP/1.1 400 Bad Request
X-GData-User-Country: US
Content-Type: application/vnd.google.gdata.error+xml
Content-Encoding: gzip
Transfer-Encoding: chunked
Date: Sun, 12 May 2013 14:58:55 GMT
Expires: Sun, 12 May 2013 14:58:55 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
<errors xmlns="http://schemas.google.com/g/2005">
<error>
<domain>GData</domain>
<code>InvalidEntryException</code>
<internalReason>Missing start boundary</internalReason>
</error>
</errors>
答案 0 :(得分:0)
没有其他人会遇到这个问题,但只是为了后代而帮助其他人,如果他们像我一样愚蠢并且遇到这个问题。我上传到了错误的网址。路径是正确的,但我上传到了错误的域名。上传域与所有其他gdata调用不同。
是
uploads.gdata.youtube.com
而不是
gdata.youtube.com