Ask Your Question
3

What are the steps to utilize the Vimeo oEmbed API in nodejs?

asked 2023-07-11 02:26:47 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-07-11 02:51:02 +0000

plato gravatar image

Below are the steps to utilize the Vimeo oEmbed API in Node.js:

  1. Install the axios library using the following command in the terminal:

    npm install axios
    
  2. Import axios and querystring modules in the Node.js app:

    const axios = require('axios');
    const querystring = require('querystring');
    
  3. Set the Vimeo API endpoint URL and video ID:

    const vimeoEndpoint = 'https://vimeo.com/api/oembed.json';
    const videoId = '123456789';
    
  4. Create a querystring with the parameters required by the Vimeo API:

    const params = querystring.stringify({
       url: `https://vimeo.com/${videoId}`,
       format: 'json'
    });
    
  5. Send the GET request to the Vimeo API endpoint using the axios library:

    axios.get(`${vimeoEndpoint}?${params}`)
    .then(response => console.log(response.data))
    .catch(error => console.log(error));
    
  6. The response from the Vimeo API will contain the oEmbed data for the requested video.

    {
       type: 'video',
       version: '1.0',
       provider_name: 'Vimeo',
       provider_url: 'https://vimeo.com/',
       title: 'Video Title',
       author_name: 'John Doe',
       author_url: 'https://vimeo.com/johndoe',
       is_plus: '0',
       account_type: 'basic',
       html: '<iframe src="https://player.vimeo.com/video/123456789" ... ></iframe>',
       width: 640,
       height: 360,
       duration: 78,
       description: 'Video Description',
       thumbnail_url: 'https://i.vimeocdn.com/video/123456789_640.jpg',
       thumbnail_width: 640,
       thumbnail_height: 360
    }
    
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-11 02:26:47 +0000

Seen: 10 times

Last updated: Jul 11 '23