Search code examples
javascriptnode.jsvimeovimeo-api

Vimeo video upload with title, description and more in node js


I have to upload video on vimeo using vimeo API with title , description and more fields.

Currently I am using the official npm modules for vimeo video uploads from here.

I have used following code for uploading video , But in that we don't have any options to passed any title or descriptions.

        lib.streamingUpload('/home/aaron/Downloads/ada.mp4',  function (error, body, status_code, headers) {
            if (error) {
                throw error;
            }

            lib.request(headers.location, function (error, body, status_code, headers) {
                console.log(body);
            });
        }, function (upload_size, file_size) {
            console.log("You have uploaded " + Math.round((uploaded_size/file_size) * 100) + "% of the video");
        });

So please let me help me on how to passed other details with this npm module methods or any other approach.


Solution

  • Right now you are sending Vimeo the video, receiving the response, and getting that video's metadata. Instead of receiving the video's metadata, you should edit it.

    The documentation is here.

    An example would look like this

    lib.request('PATCH', headers.location, {
        title: "Your new title",
        description: "Your new description"
    }, function (error, body, status_code, headers) {
        console.log(body);
    });