Fixed broken dailymotion embed video parser to match new webpage formatting
[embedvideo/.git] / ItemAddEmbedVideo.inc
index 69ee24dbd4ef0740c728f01976db142b6f1e53b9..ac3f12ad3d83091c4ea61e318440e957614ef3e7 100644 (file)
@@ -34,7 +34,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
    * @see ItemAddPlugin::handleRequest
    */
  function handleRequest($form, &$item) {
-   global $gallery;
+   global $gallery, $url;
     
    $status = $error = array();
    
@@ -568,7 +568,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
               }
 
               /* Extract the summary from the webpage contents */
-              preg_match('/<div class="description  foreground">(.+?)<\/div>/i', $contents, $matches);
+              preg_match('/<div class="description\s+foreground">(.+?)<\/div>/i', $contents, $matches);
               $summary=$matches[1];
 
               /* Extract the title from the webpage contents */
@@ -579,7 +579,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
               $thumbnail=$dailymotionThumbnailUrl.$item_id;
 
               /* Format the description to hold a reference to the embedded video */
-              if(preg_match('/Embeddable Player:.+?value="(.+?)"/', $contents, $matches)) { 
+              if(preg_match('/<textarea id="video_player_embed_code_text".+?>(.+?)<\/textarea>/', $contents, $matches)) { 
                 $description=$matches[1];
                 $description=preg_replace("/&quot;/","'",$description);
                 $description=preg_replace("/&lt;/","<",$description);
@@ -1213,7 +1213,8 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
      global $gallery;
      
      $requestMethod='GET';
-
+     $requestBody='';
+     
      /* Convert illegal characters */
      $url = str_replace(' ', '%20', $url);