Error “503 : Service unavailable” while trying to upload a video with the YouTube API

依然范特西╮ 提交于 2019-12-12 04:49:29

问题


Answered : The X-Upload-Content-Length value had a space in it.

Question :

I want to use the Youtube API to upload videos from a desktop application, in C++. I implemented the Resumable Upload, everything worked on Friday 19/07 in the afternoon, I could upload a couple of small videos, and since then I always get an error when using my app : "503 : Service Unavailable".

I found several threads treating this topic, it seems there were two solutions :

  • Retry the request several times in a row
  • Wait, it somehow works again after a while

Doing the same request again and again didn't solve it for me (I tried to do the request 5 times in a row, maybe I should do more requests ? How many ?). Here is a sample request and the response I get :

Request :

POST https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet HTTP/1.1
Accept: */*
Accept-Language: xx
Authorization: Bearer MY_ACCESS_KEY
X-GData-Key: key=MY_DEV_KEY
Content-Type: application/json
X-Upload-Content-Type: video/avi
X-Upload-Content-Length: 302 080
User-Agent: SOME_PRIVATE_STUFF
Host: www.googleapis.com
Content-Length: 167
Connection: Keep-Alive
Cache-Control: no-cache

{
"snippet": {
"title": "My video title",
"description": "This is a description of my video",
"tags": ["cool", "video", "more keywords"],
"categoryId": 22
}
} 

Response :

HTTP/1.1 503 Service Unavailable
Date: Fri, 26 Jul 2013 16:33:27 GMT
Server: HTTP Upload Server Built on Jul 21 2013 19:20:38 (1374459638)
Content-Length: 0
Content-Type: text/html; charset=UTF-8 

Thanks for any help, I really don't know what to do right now.

来源:https://stackoverflow.com/questions/17922173/error-503-service-unavailable-while-trying-to-upload-a-video-with-the-youtub

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!