brutaldesign / swipebox

A touchable jQuery lightbox
1.96k stars 668 forks source link

youtu.be shorturl issue #258

Open achensee opened 8 years ago

achensee commented 8 years ago

YouTube Short URLs like https://youtu.be/abcdefg lead to DNS Error in swipebox-video (wrong URL decoded)

To fix that, change line 784 to

iframe = '<iframe width="560" height="315" src="//www.youtube.com/embed/' + youtubeUrl[1] + '?' + qs + '" frameborder="0" allowfullscreen></iframe>';
achensee commented 8 years ago

any news on that?

hazrpg commented 7 years ago

I'm having the same issue too - people are using the shorturl youtu.be and it is causing a DNS error - so I'm having to find and replace to fix it.

andrejarh commented 6 years ago

Having same issue. youtu.be url is causing an error in the iframe: screen shot 2017-10-07 at 08 46 31

Embeding the same video on the youtube.com domain works just fine.

eriku commented 4 years ago

I fixed my copy by wrapping the short url on line 781 with another parenthesis youtubeShortUrl = url.match(/((?:www\.)?youtu\.be)\/([a-zA-Z0-9\-_]+)/), and then replacing the shortURL with the long URL (lines 785-787).

if ( youtubeShortUrl ) {
  youtubeUrl = youtubeShortUrl;
  youtubeUrl[1] = 'www.youtube.com';
}