swoopedj / youtube-api-samples

Automatically exported from code.google.com/p/youtube-api-samples
0 stars 0 forks source link

ResumableUploadError #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Returning this error when attempting to upload a file with a title, 
description, keywords, category, and privacyStatus="private"

Uploading file...
No handlers could be found for logger "oauth2client.util"
Traceback (most recent call last):
  File "/Users/mileslauridsen/Dropbox/PRODUCTION/SYSTEMS/python/upload_video.py", line 162, in <module>
    initialize_upload(options)
  File "/Users/mileslauridsen/Dropbox/PRODUCTION/SYSTEMS/python/upload_video.py", line 107, in initialize_upload
    resumable_upload(insert_request)
  File "/Users/mileslauridsen/Dropbox/PRODUCTION/SYSTEMS/python/upload_video.py", line 117, in resumable_upload
    status, response = insert_request.next_chunk()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/util.py", line 128, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/apiclient/http.py", line 747, in next_chunk
    raise ResumableUploadError(resp, content)
apiclient.errors.ResumableUploadError: <HttpError 400 "Bad Request">

Original issue reported on code.google.com by mi...@finvfx.com on 13 Apr 2013 at 10:27

GoogleCodeExporter commented 8 years ago
Found the issue.  Added the error code 400 to the least of retries and got a 
bit more info back:
A retriable HTTP error 400 occurred:
{
 "error": {
  "errors": [
   {
    "domain": "youtube.video",
    "reason": "invalidCategoryId",
    "message": "Bad Request",
    "locationType": "other",
    "location": "body.snippet.categoryId"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

So as it turns it I was trying to use a category="Film" as is described 
somewhere in the youtube v2 api python docs.  This version expects an integer 
submitted as a string.

Here's an example of how an upload worked for me:
sudo python ~/pathTo/upload_video.py --file="someVideo.mp4" --title="Test 
Upload" --description="This is a test" --keywords="test" --category="3" 
--privacyStatus="private"

And here's the category codes as I couldn't find a list anywhere: 

Film & Animation    1
Autos & Vehicles    2
Howto & Style   3
People & Blogs  4
Entertainment   5
People & Blogs  6
News & Politics 7
Entertainment   8
Comedy  9
Music   10
News & Politics 11
Comedy  12
People & Blogs  13
People & Blogs  14
Pets & Animals  15
Howto & Style   16
Sports  17
Entertainment   18
Travel & Events 19
News & Politics 21
People & Blogs  22
Comedy  23
Entertainment   24
News & Politics 25
Howto & Style   26
Education   27
Science & Technology    28
Nonprofits & Activism   29

Original comment by mi...@finvfx.com on 13 Apr 2013 at 11:19