How to get videos from vimeo in node

Khoa Pham
Khoa Pham
Nov 6, 2019 · 1 min read

Path for user users/nsspain/videos
Path for showcase developer.vimeo.com/api/reference/albums#get_album
Path for Channels, Groups and Portfolios

const Vimeo = require('vimeo').Vimeo
const vimeoClient = new Vimeo(vimeoClientId, vimeoClientSecret, vimeoAccessToken)
async getVideos(path) {
const options = {
path: `channels/staffpicks/videos`,
query: {
page: 1,
per_page: 100,
fields: 'uri,name,description,created_time,pictures'
}
}
return new Promise((resolve, reject) => {
try {
vimeoClient.request(options, (error, body, status_code, headers) => {
if (isValid(body)) {
resolve(body)
} else {
throw error
}
})
} catch (e) {
reject(e)
console.log(e)
}
})
}

Response look like

{
"total":13754,
"page":1,
"per_page":100,
"paging":{
"next":"/channels/staffpicks/videos?page=2&per_page=100&fields=uri%2Cname%2Cdescription%2Ccreated_time%2Cpictures",
"previous":null,
"first":"/channels/staffpicks/videos?page=1&per_page=100&fields=uri%2Cname%2Cdescription%2Ccreated_time%2Cpictures",
"last":"/channels/staffpicks/videos?page=138&per_page=100&fields=uri%2Cname%2Cdescription%2Ccreated_time%2Cpictures"
},
"data":[
{
"uri":"/videos/359281775",
"name":"Maestro",
"description":"A Bloom Pictures short film directed by Illogic.\n\n\"Maestro\" is this week's Staff Pick Premiere. Read more about it on the Vimeo Blog: https://vimeo.com/blog/post/staff-pick-premiere-maestro-from-illogic\n\nMaking of :\n https://vimeo.com/bloompictures/maestromakingof\n\nYou want to collaborate?\nSend us a message at : hello@bloompictures.tv\n\nFor festivals and screenings, please contact : \nfestival@miyu.fr\n\nPress/Media requests : \nbenoit@animationshowcase.com\n\nhttps://www.bloompictures.tv\n\n©Bloom Pictures 2019",
"created_time":"2019-09-11T12:31:33+00:00",
"pictures":{
"uri":"/videos/359281775/pictures/813130850",
"active":true,
"type":"custom",
"sizes":[
{
"width":100,
"height":75,
"link":"https://i.vimeocdn.com/video/813130850_100x75.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_100x75.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":200,
"height":150,
"link":"https://i.vimeocdn.com/video/813130850_200x150.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_200x150.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":295,
"height":166,
"link":"https://i.vimeocdn.com/video/813130850_295x166.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_295x166.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":640,
"height":360,
"link":"https://i.vimeocdn.com/video/813130850_640x360.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_640x360.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":1280,
"height":720,
"link":"https://i.vimeocdn.com/video/813130850_1280x720.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_1280x720.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":1920,
"height":1080,
"link":"https://i.vimeocdn.com/video/813130850_1920x1080.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_1920x1080.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":640,
"height":346,
"link":"https://i.vimeocdn.com/video/813130850_640x346.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_640x346.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":960,
"height":519,
"link":"https://i.vimeocdn.com/video/813130850_960x519.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_960x519.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":1280,
"height":692,
"link":"https://i.vimeocdn.com/video/813130850_1280x692.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_1280x692.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":1920,
"height":1038,
"link":"https://i.vimeocdn.com/video/813130850_1920x1038.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_1920x1038.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width":1280,
"height":692,
"link":"https://i.vimeocdn.com/video/813130850_1280x692.jpg?r=pad",
"link_with_play_button":"https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F813130850_1280x692.jpg&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
}
],
"resource_key":"b42ac645a67b3277cb2fe66d3894016842ceef72"
}
}
]
}

Read more

Fantageek

Simple apps that make sense

Khoa Pham

Written by

Khoa Pham

My apps https://onmyway133.github.io/

Fantageek

Fantageek

Simple apps that make sense

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade