diff --git a/ee1/pi.antenna.php b/ee1/pi.antenna.php index e9d4ad4..88967d9 100644 --- a/ee1/pi.antenna.php +++ b/ee1/pi.antenna.php @@ -86,7 +86,24 @@ public function __construct() // If it's not YouTube or Vimeo, bail if (strpos($video_url, "youtube.com/") !== FALSE) { + $url = "http://www.youtube.com/oembed?format=json&url="; + + // If it's youtube and from a gdata feed, let's put it in the + // format that oembed likes. - Change by Jesse Bunch + if (strpos($video_url, "gdata.youtube.com") !== FALSE) { + + $arrMatches = array(); + preg_match('/videos\/([A-Za-z0-9\-\_]+)\/?$/', $video_url, $arrMatches); + + if (!empty($arrMatches[1])) { + $video_url = sprintf('http://youtube.com/watch?v=%s', $arrMatches[1]); + } + + unset($arrMatches); + + } + } else if (strpos($video_url, "vimeo.com/") !== FALSE) { $url = "http://vimeo.com/api/oembed.json?url="; } else if (strpos($video_url, "wistia.com/") !== FALSE) { diff --git a/ee2/antenna/pi.antenna.php b/ee2/antenna/pi.antenna.php index b022f51..b4c68f8 100644 --- a/ee2/antenna/pi.antenna.php +++ b/ee2/antenna/pi.antenna.php @@ -73,7 +73,24 @@ public function Antenna() // If it's not YouTube or Vimeo, bail if (strpos($video_url, "youtube.com/") !== FALSE) { + $url = "http://www.youtube.com/oembed?format=json&url="; + + // If it's youtube and from a gdata feed, let's put it in the + // format that oembed likes. - Change by Jesse Bunch + if (strpos($video_url, "gdata.youtube.com") !== FALSE) { + + $arrMatches = array(); + preg_match('/videos\/([A-Za-z0-9\-\_]+)\/?$/', $video_url, $arrMatches); + + if (!empty($arrMatches[1])) { + $video_url = sprintf('http://youtube.com/watch?v=%s', $arrMatches[1]); + } + + unset($arrMatches); + + } + } else if (strpos($video_url, "vimeo.com/") !== FALSE) { $url = "http://vimeo.com/api/oembed.json?url="; } else if (strpos($video_url, "wistia.com/") !== FALSE) {