Hi,

the function emvideo_dailymotion_extract() doesn't work when several IDs are passed to the URL.
Example :
http://www.dailymotion.com/playlist/xxxxxx_example_title_playlist/video/yyyyyy_example_title_video

I used preg_match_all() function instead of preg_match(), and used array_pop() to return the last value.

Here is the code :

function emvideo_dailymotion_extract($embed = '') {
  if (preg_match('@dailymotion\.com/swf/([^"\&]+)@i', $embed, $matches)) {
    return $matches[1];
  }
  if (preg_match('@dailymotion\.com@i', $embed, $matches)) {
  	if (preg_match_all('@/([^/_]+)_@i', $embed, $matches)) {
      $id = array_pop($matches[1]);
      if (!is_array($id) && $id != NULL) {
      	return $id;
      }
    }
  }
  return array();
}

This code returns the last ID in the URL. Perhaps it would be better to catch "videos/xxxxxx_" instead...

Regards,

Nicolas Bourdial.

CommentFileSizeAuthor
#1 dailymotion.patch759 bytesrobloach

Comments

robloach’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
StatusFileSize
new759 bytes

Do you have some URLs to test this out on? Not sure what error your running into.

nbourdial’s picture

here is an example : http://www.dailymotion.com/playlist/xuo9l_TOULOUSEFOOTBALLCLUB_news/vide...
the first ID is the playlist's ID.

aaron’s picture

Status: Needs review » Needs work

seems like catching for videos/xyz123 would be better; that's a fairly simple regex pattern.

Gabriel R.’s picture

Yes, I've noticed this as well. Another URL examples is
http://www.dailymotion.com/relevance/search/beyonce+dreams/video/x9zmoq_... Don't hold the content of that search against me :-)