You are here

function emvideo_metacafe_extract in Embedded Media Field 6

Same name and namespace in other branches
  1. 6.3 contrib/emvideo/providers/metacafe.inc \emvideo_metacafe_extract()

we're going to handle our own matches, unless someone can come up with a regex that will match this better

File

contrib/emvideo/providers/metacafe.inc, line 33
This include processes metacafe.com media files for use by emfield.module.

Code

function emvideo_metacafe_extract($embed) {

  // http://www.metacafe.com/watch/479957/gorilla_prank/
  if ($embed && preg_match('@metacafe\\.com/watch/(.[^/]*)/(.[^/]*)/@i', $embed, $matches)) {
    return $matches[1] . '/' . $matches[2];
  }
  else {
    if ($embed && preg_match('@metacafe\\.com/watch/(.[^/]*)/(.*)@i', $embed, $matches)) {
      return $matches[1] . '/' . $matches[2];
    }
    else {
      if ($embed && preg_match('@metacafe\\.com/fplayer/(.[^/]*)/(.[^\\.]*)\\.@i', $embed, $matches)) {
        return $matches[1] . '/' . $matches[2];
      }
    }
  }
  return FALSE;
}