1
0
Fork 0
mirror of https://github.com/hedgedoc/hedgedoc.git synced 2025-03-29 07:33:31 +00:00

Replace vimeo meta data api

Vimeo deprecated the v2 api and recommends to
use https://developer.vimeo.com/api/oembed/videos

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-05-15 21:25:03 +02:00
parent 3762c6a00d
commit 41b9ab956c
No known key found for this signature in database
GPG key ID: B97799103358209B

View file

@ -294,14 +294,14 @@ export function finishView (view) {
imgPlayiframe(this, '//player.vimeo.com/video/')
})
.each((key, value) => {
const vimeoLink = `https://vimeo.com/${$(value).attr('data-videoid')}`
$.ajax({
type: 'GET',
url: `//vimeo.com/api/v2/video/${$(value).attr('data-videoid')}.json`,
url: `https://vimeo.com/api/oembed.json?url=${encodeURIComponent(vimeoLink)}`,
jsonp: 'callback',
dataType: 'jsonp',
success (data) {
const thumbnailSrc = data[0].thumbnail_large
const image = `<img src="${thumbnailSrc}" />`
const image = `<img src="${data.thumbnail_url}" />`
$(value).prepend(image)
if (window.viewAjaxCallback) window.viewAjaxCallback()
}