问题
We're developing in java 7 and YouTube Data API v3.
When we are calling the upload service with "processingDetails" part, we are getting a 503 Service Unavailable Error. What are we doing wrong? If we remove it, we can upload the video just fine. But we want/need to know about processingDetails.
Here is the code:
YouTube.Videos.Insert videoInsert = this.youtube.videos().insert("snippet,statistics,status,processingDetails", videoObjectDefiningMetadata, mediaContent);
everything else it's the same as the java client provided in google API.
Here is the request: https://www.googleapis.com/upload/youtube/v3/videos?part=snippet,statistics,status,processingDetails
And here is the exception stack trace:
2013-06-14 17:50:40,375 ERROR [] [main] (...)despegar.client.impl.YouTubeMediaClient (YouTubeMediaClient.java:264) : Error com.google.api.client.googleapis.json.GoogleJsonResponseException: 503 Service Unavailable at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:111) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:38) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:423) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) at com.despegar.client.impl.YouTubeMediaClient.uploadVideoWithFailureRecovery(YouTubeMediaClient.java:285) at com.despegar.client.impl.YouTubeMediaClient.uploadAttempt(YouTubeMediaClient.java:260)
Thanks!
回答1:
Two things:
- The
part
parameter values you include in youryoutube.videos.insert()
request should correspond to the parts you're specifying in the upload metadata. Normally this would besnippet
(since that's the part containing the required title and description) and sometimesstatus
(if you're also setting the public/private status of the video). You can't setstatistics
orprocessingDetails
during an upload, so you shouldn't include them in the list of parts. You can still request thestatistics
orprocessingDetails
parts after the upload completes, via ayoutube.videos.list()
call. - The API should return a meaningful error message explaining this to you instead of returning a generic 503. I'll file a bug with the engineering team asking them to take care of that.
来源:https://stackoverflow.com/questions/17117436/error-while-using-part-processingdetails-in-a-youtube-videos-insert-requ