You are here

function video_cck_yahoomusic_extract in Embedded Media Field 5

hook video_cck_PROVIDER_extract this is called to extract the video code from a pasted URL or embed code.

Parameters

$embed: an optional string with the pasted URL or embed code

Return value

either an array of regex expressions to be tested, or a string with the video code to be used if the hook tests the code itself, it should return either the string of the video code (if matched), or an empty array. otherwise, the calling function will handle testing the embed code against each regex string in the returned array.

File

contrib/video_cck/providers/yahoomusic.inc, line 176
This include processes Yahoo Music API media files for use by emfield.module.

Code

function video_cck_yahoomusic_extract($embed = '') {

  // http://new.music.yahoo.com/videos/--205781579
  // http://new.uk.music.yahoo.com/videos/Coldplay/Violet-Hill--60339090;_ylt=ApVMaK9zo0I8Fb03YCMv5qz1ECYv
  // http://new.music.yahoo.com/T-I-/videos/view/Whatever-You-Like--184525308
  if ($embed && preg_match('@(.*)yahoo.com(.*)--([0-9]+)@i', $embed, $matches)) {
    return $matches[3];
  }
  else {
    if ($embed && preg_match('@id=v([^"\\&]+)@i', $embed, $matches)) {
      return $matches[1];
    }
  }
  return FALSE;
}