X-Git-Url: http://git.pippins.net/embedvideo/.git/.%24link.?a=blobdiff_plain;ds=sidebyside;f=ItemAddEmbedVideo.inc;h=6bb160fbc5b7ebaff3e94f00b1d1b6e0ece01a08;hb=c89207ee0c133a7176a21d0bca5d452a17977488;hp=ac3f12ad3d83091c4ea61e318440e957614ef3e7;hpb=8870ef4a2301f397d4b71da6ac25f4e2e5564199;p=embedvideo%2F.git diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc index ac3f12a..6bb160f 100644 --- a/ItemAddEmbedVideo.inc +++ b/ItemAddEmbedVideo.inc @@ -178,14 +178,33 @@ class ItemAddEmbedVideo extends ItemAddPlugin { ***************************** */ if(preg_match("/$youtubeUrlPattern/",$url)) { - + /* Make sure we can find a video_id in the URL */ - if(preg_match("/watch\?v=(.*)/",$url,$matches)) { + $extra_params = ""; + if(preg_match("/watch\?v=(.*?)(&\S+=\S+)/",$url,$matches)) { + $video_id = $matches[1]; + $extra_params = $matches[2]; + } else if (preg_match("/watch\?v=(.*)/",$url,$matches)) { $video_id = $matches[1]; } else { return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER,__FILE__,__LINE__, "Unable to extract video id from url: $url"),null,null); } + + /* If extra params were given, handle them here */ + if(strcmp($extra_params,"")) { + /* Handle the HD format information */ + if(preg_match("/fmt=(\d+)/",$extra_params,$matches)) { + $extra_params="&ap=%2526fmt%3D".$matches[1]; + } + } + + if(!strcmp($debugOutput,"true")) { + print "