Below are the steps to utilize the Vimeo oEmbed API in Node.js:
Install the axios
library using the following command in the terminal:
npm install axios
Import axios
and querystring
modules in the Node.js app:
const axios = require('axios');
const querystring = require('querystring');
Set the Vimeo API endpoint URL and video ID:
const vimeoEndpoint = 'https://vimeo.com/api/oembed.json';
const videoId = '123456789';
Create a querystring with the parameters required by the Vimeo API:
const params = querystring.stringify({
url: `https://vimeo.com/${videoId}`,
format: 'json'
});
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));
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
}
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
Asked: 2023-07-11 02:26:47 +0000
Seen: 10 times
Last updated: Jul 11 '23
What are the steps to restrict the overall file size of uploaded files in NestJS using multer?
How do I delete my Git credentials?
What are the steps to perform server side printing using .net 6 and PdfSharpCore?
How can one open the "What's New" window in IntelliJ?
What are the steps to complete the merge process once I have resolved conflicts?
What is the method to obtain the public URL of a file in TYPO3?
What are the steps to set up TA-lib on Google Colab?
What are the steps to configure a gstreamer v4l2src stream-mmap?
What are the steps to create a fixed right-hand side bar on a modal using tailwindcss?