Fixed dailymotion import issues
[embedvideo/.git] / ItemAddEmbedVideo.inc
index 544c5225cd970821b8ff23a6379f983313e97ced..2ba1adf30853a3884883c3e4d30ccdf289c697da 100644 (file)
@@ -214,11 +214,15 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
                 /* Handle the high quality format information */
                 if(preg_match("/fmt=(\d+)/",$extra_params,$matches)) {
                   $extra_params="&ap=%2526fmt%3D".$matches[1];
+                  if(!strcmp($matches[1],"22")) {
+                     //$youtubeWidth=1280;
+                     //$youtubeHeight=720;
+                   }
                 }
               }
                       
               /* Youtube api feed */
-              $feed = $youtubeApiUrl."videos/$video_id";
+              $feed = $youtubeApiUrl."videos/".urlencode($video_id);
 
               if(!strcmp($debugOutput,"true")) {
                   print "\n<h2>Youtube URL Parsing Results</h2>";
@@ -574,7 +578,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
               $thumbnail=$dailymotionThumbnailUrl.$item_id;
 
               /* Format the description to hold a reference to the embedded video */
-              if(preg_match('/<.+? value="(.+?)" class=".+?" id="video_player_embed_code_text" \/>/', $contents, $matches)) { 
+              if(preg_match('/embed code:.+? value="(.+?)" /', $contents, $matches)) { 
                 $description=$matches[1];
                 $description=preg_replace("/&quot;/","'",$description);
                 $description=preg_replace("/&lt;/","<",$description);
@@ -800,7 +804,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
               $title=$matches[1];
 
               /* Extract the thumbnail URL from the webpage contents */
-              preg_match('/"videothumbnail" href="(.+?)"/i',
+              preg_match('/"og:image" content="(.+?)"/i',
                          $contents, $matches);
               $thumbnail=$matches[1];