Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function youtube_parser(url){
- var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
- var match = url.match(regExp);
- if (match&&match[7].length==11){
- return match[7];
- }else{
- alert("Url incorrecta");
- }
- }
- $('.url_video').html(function(){
- var video_id = youtube_parser(this);
- $('.img-video').append('<img src=http://i1.ytimg.com/vi/'+video_id+'/hqdefault.jpg width=595px>');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement