I am trying to allow users to upload YouTube videos from my website, but am not using the Javascript API, as users need to be able to upload content to my channel, rather than using their own accounts, and I couldn't figure out how to do that with the JS API.
Anyway, the end result is that I have an HTML element posting the video. The video gets uploaded, but ends up with title "unknown" and no description, etc. Not sure what I am doing wrong. Here is the payload of the HTTP POST (as multipart/form-data
) that's getting sent to https://www.googleapis.com/upload/youtube/v3/videos?part=snippet,status&access_token=[accesstoken] :
------WebKitFormBoundaryqKACn63lpjqwi0sA
Content-Disposition: form-data; name="status[privacyStatus]"
unlisted
------WebKitFormBoundaryqKACn63lpjqwi0sA
Content-Disposition: form-data; name="snippet[title]"
Test Video Title
------WebKitFormBoundaryqKACn63lpjqwi0sA
Content-Disposition: form-data; name="snippet[description]"
Test video description
------WebKitFormBoundaryqKACn63lpjqwi0sA
Content-Disposition: form-data; name="videoFile"; filename="test_vide_upload.mp4"
Content-Type: video/mp4
------WebKitFormBoundaryqKACn63lpjqwi0sA--
I am assuming that the form names for snippet
and status
fields are wrong, but I've tried various options and can't get anything to work. I also tried sending a single form field data
with the JSON-encoded value {"snippet":{"description":"Test video description","title":"Test Video Title"},"status":{"privacyStatus":"unlisted"}}
but that did not work either.
I do always get a successful JSON response from the API, with the snippet, and status, and the video is uploaded, but the snippet and status have not been set, they are either empty or default values. Any clues?