mpratt / Embera

A Oembed consumer library, that gives you information about urls. It helps you replace urls to youtube or vimeo for example, with their html embed code. It has advanced features like offline support, responsive embeds and caching support.
MIT License
335 stars 59 forks source link

Vimeo private video links #90

Closed jacksleight closed 2 years ago

jacksleight commented 2 years ago

Vimeo's oEmbed API supports private links, however the Vimeo provider does not have a regex for these so they don't work with Embera.

For example, this link https://vimeo.com/585333437/4c8cc133a5 works via oEmbed: https://vimeo.com/api/oembed.json?url=https://vimeo.com/585333437/4c8cc133a5

I added this to Embera as a test and it worked, although I'm not sure exactly what the rules are for the hash on the end, I guess it may not always be 10 chars.

            preg_match('~vimeo\.com/(?:[0-9]{5,})/(?:[0-9a-z]{10})$~i', (string) $url) ||
mpratt commented 2 years ago

Hi @jacksleight ! Thanks for the info! Version 2.0.22, now uses your regex in order to support Vimeo private links.