X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=ItemAddEmbedVideo.inc;h=bbb941d3a6562f6d652a62af5ef336cd66f8f6a4;hb=ebec4ad4f9051c9101dfb1ff331ea5a1a1832094;hp=4e16f42b64a17da624bdd5cc76ed2447a935a551;hpb=6873be3aaa2b28177e7d880086479211b9ea4120;p=embedvideo%2F.git diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc index 4e16f42..bbb941d 100644 --- a/ItemAddEmbedVideo.inc +++ b/ItemAddEmbedVideo.inc @@ -175,8 +175,12 @@ class ItemAddEmbedVideo extends ItemAddPlugin { $unsupported_url=0; /* Store the passed URL in a shorter local variable */ + /* Strip trailing whitespace in the url, this will cause problems later */ $url = $form['webPage']['URL']; - + if(preg_match("/(.*?)\s+/",$url,$matches)) { + $url = $matches[1]; + } + /* ***************************** * Embed a Youtube Video @@ -331,7 +335,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin { } /* Extract the thumbnail URL from the webpage contents */ - preg_match('/thumbnail: \'(http:\/\/.*?\/ThumbnailServer2.+?)\'/i', + preg_match('/\'(http:\/\/.*?\/ThumbnailServer2.+?)\'/i', $contents, $matches); $thumbnail=$matches[1]; $thumbnail=preg_replace("/\\\\x26/","&",$thumbnail);