示例#1
0
 function calcula()
 {
     //titulo
     $titulo = utf8_encode(entre1y2($this->web_descargada, '<title>', '<'));
     //utf-8... mirar esto
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     $p = strpos($this->web_descargada, 'og:image');
     $imagen = entre1y2_a($this->web_descargada, $p, 'content="', '"');
     dbug('imagen=' . $imagen);
     if (enString($this->web_descargada, 'og:video')) {
         $p = strpos($this->web_descargada, 'og:video');
         $url = entre1y2_a($this->web_descargada, $p, 'content="', '"');
         dbug('video=' . $url);
         $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'http')));
     } elseif (enString($this->web_descargada, '<object class="BrightcoveExperience"')) {
         $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array());
         require_once 'brightcove-funciones.php';
         /*
         $ejemplo = 'AAMAAAABAEZjb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkV4cGVyaWVuY2VSdW50aW1lRmFjYWRlLmdldERhdGFGb3JFeHBlcmllbmNlAAIvMQAAAe4KAAAAAgIAKGQ4Y2ZhOGIwZWQwYWVlM2YyMmRmZWRlMGYyZTU4NzRjYjViNGFmNjcRCmNjY29tLmJyaWdodGNvdmUuZXhwZXJpZW5jZS5WaWV3ZXJFeHBlcmllbmNlUmVxdWVzdCFjb250ZW50T3ZlcnJpZGVzGWV4cGVyaWVuY2VJZAdVUkwTcGxheWVyS2V5GWRlbGl2ZXJ5VHlwZRFUVExUb2tlbgkDAQqBA1Njb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkNvbnRlbnRPdmVycmlkZRtjb250ZW50UmVmSWRzDXRhcmdldBVjb250ZW50SWRzF2NvbnRlbnRUeXBlE2NvbnRlbnRJZBtmZWF0dXJlZFJlZklkGWNvbnRlbnRSZWZJZBVmZWF0dXJlZElkAQYXdmlkZW9QbGF5ZXIBBAAFQoobzh2jSAABAQV/////4AAAAAVCg917rY7IAAaBF2h0dHA6Ly93d3cudnRlbGV2aXNpb24uZXMvcHJvZ3JhbWFzL3ZheWF2LzIwMTQvMDUvMjcvMDAzMV8zNTg4MzQwNTYxMDAxLmh0bQZlQVF+fixBQUFDZXpINWhNa34sa29OVmZFd3lwcTZXeGYyS01zN3EtM2V1R0wyOU1Pck0Ff////+AAAAAGAQ==';
         $ejemplo = base64_decode($ejemplo);
         print_r(brightcove_decode($ejemplo));
         */
         preg_match('/<param value="(.*?)" name="playerID"/', $this->web_descargada, $matches);
         $experienceID = $matches[1];
         preg_match('/<param value="(.*?)" name="playerKey"/', $this->web_descargada, $matches);
         $playerKey = $matches[1];
         preg_match('/<param value="(.*?)" name="@videoPlayer"/', $this->web_descargada, $matches);
         $contentId = $matches[1];
         $messagebroker = "http://c.brightcove.com/services/messagebroker/amf?playerKey=" . $playerKey;
         $a_encodear = array('target' => 'com.brightcove.experience.ExperienceRuntimeFacade.getDataForExperience', 'response' => '/1', 'data' => array('0' => 'd8cfa8b0ed0aee3f22dfede0f2e5874cb5b4af67', '1' => new SabreAMF_AMF3_Wrapper(new SabreAMF_TypedObject('com.brightcove.experience.ViewerExperienceRequest', array('TTLToken' => null, 'deliveryType' => NAN, 'URL' => $this->web, 'experienceId' => $experienceID, 'playerKey' => $playerKey, 'contentOverrides' => array('0' => new SabreAMF_TypedObject('com.brightcove.experience.ContentOverride', array('contentRefIds' => null, 'target' => 'videoPlayer', 'contentIds' => null, 'contentType' => 0, 'contentId' => $contentId, 'featuredRefId' => null, 'contentRefId' => null, 'featuredId' => NAN))))))));
         $post = brightcove_encode($a_encodear);
         //print_r(brightcove_decode($post));
         dbug('a descargar: ' . $messagebroker);
         $t = brightcove_curl_web($messagebroker, $post);
         $res_decoded = brightcove_decode($t);
         dbug('RESPUESTA BRIGHTCOVE:');
         dbug_r($res_decoded);
         /*
         view-source:http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=3588406440001
         http://progresive.lavozdegalicia.es/BCOVE/VTV/pd/2728142669001/201405/3588406440001/2728142669001_3588406440001_s-1.ts?
         http://videohdvtv-vh.akamaihd.net/BCOVE/VTV/hd/2728142669001/201405/2728142669001_3588398678001_PRG-VAYAVT4-0032.mp4
         http://progresive.lavozdegalicia.es/BCOVE/VTV/hd/2728142669001/201405/2728142669001_3588398678001_PRG-VAYAVT4-0032.mp4
         */
         $base = $res_decoded['data']->getAMFData();
         $base = $base['programmedContent']['videoPlayer']->getAMFData();
         $base = $base['mediaDTO']->getAMFData();
         $obtenido['enlaces'] = brightcove_genera_obtenido($this, $base, array('IOSRenditions' => 'm3u8', 'renditions' => 'http'));
     }
     finalCadena($obtenido);
 }
示例#2
0
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     preg_match("@([0-9]+?)(?:\\.html|-)@", $this->web, $matches);
     dbug_r($matches);
     if (!isset($matches[1]) || !is_numeric($matches[1])) {
         // http://granadacf.ideal.es/noticias/201410/20/entrenamiento-mucho-contenido-fisico-20141020130408.html
         // http://granadacf.ideal.es/modgen/?idModulo=rediseno2014/PPLL_playerVideoShowVideo&modoExtendido=player&idDivVideo=video_3849210620001_3092136624146_1_1413829041980&classVideo=story&widthVideo=490&heightVideo=490&idVideo=3849210620001&linkURLVideo=http%3A//www.ideal.es/videos/granadacf/201410/20/entrenamiento-mucho-contenido-fisico-3849210620001-mm.html&stillURLVideo=http%3A//www.ideal.es/noticias/201410/20/media/cortadas/entreno--490x490.jpg&medio=ideal&dominio=http%3A//www.ideal.es&location=granadacf.ideal.es&nameVideo=Entrenamiento%20con%20mucho%20contenido%20f%26iacute%3Bsico%20para%20iniciar%20la%20semana&shortDescriptionVideo=Entrenamiento%20con%20mucho%20contenido%20f%26iacute%3Bsico%20para%20iniciar%20la%20semana&creationDateMilisecondsVideo=1413821723&origenVideo=bc&capaModal=true&usoResizer=false&autoStartVideo=true&charset=WINDOWS-1252&authorVideo=STUDIO%20SUR&smoothingVideo=false&loid=30.9.2136624146&dispositivo=pc
         setErrorWebIntera("No se ha encontrado ningún vídeo.");
         return;
     }
     // http://www.ideal.es/videos/granada/noticias/1342041315001-02184-serie-tercer-premio-acera-darro.html
     $idVideo = $matches[1];
     $datosBC = "http://modulos-mm.ideal.es/includes/manuales/videos/php/proxyModgen.php?idVideo=" . $idVideo . "&idModulo=VOC_playerVideoShowVideo&modoExtendido=player&idDivVideo=video&medio=ideal&origenVideo=bc";
     $datosBC = CargaWebCurl($datosBC);
     dbug($datosBC);
     $publisherID = entre1y2($datosBC, '"publisherID" value="', '"');
     $playerID = entre1y2($datosBC, '"playerID" value="', '"');
     //$urlBC = 'http://c.brightcove.com/services/viewer/federated_f9?&flashID='.$matches[1].'-bcObject&playerID='.$playerID.'&publisherID='.$publisherID.'&%40videoPlayer='.$matches[2].'&isVid=true&isUI=true&linkBaseURL='.urlencode('http://www.hogarutil.com'.$matches[6]);
     //http://c.brightcove.com/services/messagebroker/amf?playerKey=AQ~~,AAAAEUA28vk~,ZZqXLYtFw-ADB2SpeHfBR3cyrCkvIrAe
     $messagebroker = "http://c.brightcove.com/services/messagebroker/amf?playerId=" . $playerID;
     include 'brightcove-funciones.php';
     $a_encodear = array("target" => "com.brightcove.experience.ExperienceRuntimeFacade.getDataForExperience", "response" => "/1", "data" => array("0" => "ebcf49ebfaf7ae1b09cf79a1ab47c1286b3a0605", "1" => new SabreAMF_AMF3_Wrapper(new SabreAMF_TypedObject("com.brightcove.experience.ViewerExperienceRequest", array("TTLToken" => null, "deliveryType" => NAN, "URL" => $this->web, "experienceId" => $playerID, "playerKey" => null, "contentOverrides" => array("0" => new SabreAMF_TypedObject("com.brightcove.experience.ContentOverride", array("contentIds" => null, "contentRefId" => null, "contentRefIds" => null, "featuredRefId" => null, "contentType" => 0, "target" => "videoPlayer", "featuredId" => NAN, "contentId" => $idVideo))))))));
     $post = brightcove_encode($a_encodear);
     //$test="AAMAAAABAEZjb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkV4cGVyaWVuY2VSdW50aW1lRmFjYWRlLmdldERhdGFGb3JFeHBlcmllbmNlAAIvMQAAAdAKAAAAAgIAKGViY2Y0OWViZmFmN2FlMWIwOWNmNzlhMWFiNDdjMTI4NmIzYTA2MDURCmNjY29tLmJyaWdodGNvdmUuZXhwZXJpZW5jZS5WaWV3ZXJFeHBlcmllbmNlUmVxdWVzdCFjb250ZW50T3ZlcnJpZGVzEVRUTFRva2VuGWRlbGl2ZXJ5VHlwZQdVUkwZZXhwZXJpZW5jZUlkE3BsYXllcktleQkDAQqBA1Njb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkNvbnRlbnRPdmVycmlkZRVjb250ZW50SWRzGWNvbnRlbnRSZWZJZBtjb250ZW50UmVmSWRzG2ZlYXR1cmVkUmVmSWQXY29udGVudFR5cGUNdGFyZ2V0FWZlYXR1cmVkSWQTY29udGVudElkAQEBAQQABhd2aWRlb1BsYXllcgV/////4AAAAAVCgOqrnL6IAAYBBX/////gAAAABoE/aHR0cDovL3d3dy5pZGVhbC5lcy92aWRlb3MvZ3JhbmFkYS9ub3RpY2lhcy8yMzI1MDEwOTQ2MDAxLWRpbGlnZW5jaWFzLXZ1ZWx2ZW4tdmFsbGUtbGVjcmluLmh0bWwFQlH8m6HwQAAGAQ==";
     //dbug_r(brightcove_decode(base64_decode($test)));
     dbug('a descargar: ' . $messagebroker);
     /*$t=brightcove_curl_web("http://forestrf.no-ip.org/",$post); //borrar, es una prueba
     dbug_($t);
     exit;*/
     $t = brightcove_curl_web($messagebroker, $post);
     dbug_($t);
     $res_decoded = brightcove_decode($t);
     dbug("PRIMERA RESPUESTA BRIGHTCOVE:");
     dbug_r($res_decoded);
     $base = $res_decoded["data"]->getAMFData();
     $base = $base['programmedContent']['videoPlayer']->getAMFData();
     $base = $base['mediaDTO']->getAMFData();
     dbug_r($base);
     $titulo = $base["linkText"];
     $imagen = $base["videoStillURL"];
     dbug('titulo = ' . $titulo);
     dbug('imagen = ' . $imagen);
     $obtenido['enlaces'] = brightcove_genera_obtenido($this, $base, array('IOSRenditions' => 'm3u8', 'renditions' => 'rtmp'));
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido, false);
 }
示例#3
0
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     //http://c.brightcove.com/services/viewer/federated_f9?&flashID=ms-player2-continuo-bcObject&playerID=2418571368001&publisherID=2385340627001&%40videoPlayer=2875076343001&isVid=true&isUI=true&linkBaseURL=".urlencode()
     $patron = '@GENERAL.videoBrightcove.*?\\(.*?"(.*?)".*?,.*?"(.*?)"@i';
     preg_match($patron, $this->web_descargada, $matches);
     dbug_r($matches);
     if (!isset($matches[2]) || !is_numeric($matches[2])) {
         setErrorWebIntera("No se ha encontrado ningún vídeo.");
         return;
     }
     $contentId = $matches[2];
     $publisherID = 2385340627001;
     $playerID = 2418571368001;
     //$urlBC = 'http://c.brightcove.com/services/viewer/federated_f9?&flashID='.$matches[1].'-bcObject&playerID='.$playerID.'&publisherID='.$publisherID.'&%40videoPlayer='.$matches[2].'&isVid=true&isUI=true&linkBaseURL='.urlencode('http://www.hogarutil.com'.$matches[6]);
     //http://c.brightcove.com/services/messagebroker/amf?playerKey=AQ~~,AAAAEUA28vk~,ZZqXLYtFw-ADB2SpeHfBR3cyrCkvIrAe
     $messagebroker = "http://c.brightcove.com/services/messagebroker/amf?playerId=" . $playerID;
     include 'brightcove-funciones.php';
     $a_encodear = array("target" => "com.brightcove.experience.ExperienceRuntimeFacade.getDataForExperience", "response" => "/1", "data" => array("0" => "8ea8d3dc9fe7f3763119fb54107e6b5f814b876f", "1" => new SabreAMF_AMF3_Wrapper(new SabreAMF_TypedObject("com.brightcove.experience.ViewerExperienceRequest", array("TTLToken" => null, "deliveryType" => NAN, "playerKey" => "", "URL" => $this->web, "experienceId" => $playerID, "contentOverrides" => array("0" => new SabreAMF_TypedObject("com.brightcove.experience.ContentOverride", array("target" => "videoPlayer", "featuredId" => NAN, "contentType" => 0, "contentId" => $contentId, "featuredRefId" => null, "contentIds" => null, "contentRefId" => null, "contentRefIds" => null))))))));
     $post = brightcove_encode($a_encodear);
     dbug('a descargar: ' . $messagebroker);
     $t = brightcove_curl_web($messagebroker, $post);
     dbug($t);
     $res_decoded = brightcove_decode($t);
     dbug("PRIMERA RESPUESTA BRIGHTCOVE:");
     dbug_r($res_decoded);
     $base = $res_decoded["data"]->getAMFData();
     $base = $base['programmedContent']['videoPlayer']->getAMFData();
     $base = $base['mediaDTO']->getAMFData();
     dbug_r($base);
     $titulo = $base["displayName"];
     $imagen = $base["videoStillURL"];
     dbug('titulo = ' . $titulo);
     dbug('imagen = ' . $imagen);
     $obtenido['enlaces'] = brightcove_genera_obtenido(false, $base, array('IOSRenditions' => 'm3u8', 'renditions' => 'rtmpConcreto'), $titulo);
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     $obtenido['descripcion'] = $base["longDescription"];
     finalCadena($obtenido, false);
 }
示例#4
0
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     if (preg_match('#<param.+?name="@videoPlayer".+?value="(.+?)"#', $this->web_descargada, $matches)) {
         $contentId = $matches[1];
     } else {
         setErrorWebIntera('No se ha encontrado ningún vídeo.');
         return;
     }
     if (preg_match('#<param.+?name="playerID".+?value="(.+?)"#', $this->web_descargada, $matches)) {
         $experienceID = $matches[1];
     } else {
         setErrorWebIntera('No se ha encontrado ningún vídeo.');
         return;
     }
     dbug('$contentId -> ' . $contentId);
     dbug('experienceID = playerId -> ' . $experienceID);
     $messagebroker = 'http://c.brightcove.com/services/messagebroker/amf?playerId=' . $experienceID;
     include 'brightcove-funciones.php';
     $a_encodear = array('target' => 'com.brightcove.experience.ExperienceRuntimeFacade.getDataForExperience', 'response' => '/1', 'data' => array('0' => 'fcc17f21d09457d5e28d64c3dc0c0a3cb8863710', '1' => new SabreAMF_AMF3_Wrapper(new SabreAMF_TypedObject('com.brightcove.experience.ViewerExperienceRequest', array('contentOverrides' => array(new SabreAMF_TypedObject('com.brightcove.experience.ContentOverride', array('featuredRefId' => null, 'contentIds' => null, 'contentRefId' => null, 'contentType' => 0, 'target' => 'videoPlayer', 'contentRefIds' => null, 'featuredId' => NAN, 'contentId' => $contentId))), 'playerKey' => null, 'TTLToken' => null, 'deliveryType' => NAN, 'URL' => $this->web, 'experienceId' => $experienceID)))));
     $post = brightcove_encode($a_encodear);
     dbug('a descargar: ' . $messagebroker);
     $t = brightcove_curl_web($messagebroker, $post);
     dbug_($t);
     $res_decoded = brightcove_decode($t);
     dbug('PRIMERA RESPUESTA BRIGHTCOVE (enlaces de vídeos aquí):');
     dbug_r($res_decoded);
     $base = $res_decoded['data']->getAMFData();
     $base2 = $base['programmedContent']['videoPlayer']->getAMFData();
     $base3 = $base2['mediaDTO']->getAMFData();
     $titulo = $base3['displayName'];
     $titulo = limpiaTitulo($titulo);
     $imagen = $base3['videoStillURL'];
     dbug('titulo = ' . $titulo);
     dbug('imagen = ' . $imagen);
     $obtenido['enlaces'] = brightcove_genera_obtenido(false, $base3, array('IOSRenditions' => 'm3u8', 'renditions' => 'rtmpConcreto'), $titulo);
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido, false);
 }
示例#5
0
 function calculatv()
 {
     $obtenido = array('enlaces' => array());
     //http://c.brightcove.com/services/messagebroker/amf?playerKey=AQ~~,AAAAEUA28vk~,ZZqXLYtFw-ADB2SpeHfBR3cyrCkvIrAe
     if (enString($this->web_descargada, '<param name="playerKey"')) {
         $playerKey = entre1y2($this->web_descargada, '<param name="playerKey" value="', '"');
     }
     if (!isset($playerKey)) {
         setErrorWebIntera('No se ha encontrado ningún vídeo.');
         return;
     }
     dbug('playerKey -> ' . $playerKey);
     $messagebroker = 'http://c.brightcove.com/services/messagebroker/amf?playerKey=' . $playerKey;
     if (enString($this->web_descargada, '<param name="playerID"')) {
         $experienceID = entre1y2($this->web_descargada, '<param name="playerID" value="', '"');
     }
     if (!isset($experienceID)) {
         setErrorWebIntera('No se ha encontrado ningún vídeo.');
         return;
     }
     dbug('experienceID -> ' . $experienceID);
     include 'brightcove-funciones.php';
     $a_encodear = array('target' => 'com.brightcove.experience.ExperienceRuntimeFacade.getDataForExperience', 'response' => '/1', 'data' => array('0' => 'a8cdc396a50ca2415ddd0e33cca179431347adc5', '1' => new SabreAMF_AMF3_Wrapper(new SabreAMF_TypedObject('com.brightcove.experience.ViewerExperienceRequest', array('TTLToken' => null, 'deliveryType' => NAN, 'URL' => $this->web, 'experienceId' => $experienceID, 'playerKey' => $playerKey, 'contentOverrides' => null)))));
     $post = brightcove_encode($a_encodear);
     dbug('a descargar: ' . $messagebroker);
     $t = brightcove_curl_web($messagebroker, $post);
     $res_decoded = brightcove_decode($t);
     dbug('PRIMERA RESPUESTA BRIGHTCOVE:');
     dbug_r($res_decoded);
     $publisherId1 = $res_decoded['data']->getAMFData();
     $publisherId = $publisherId1['publisherId'];
     dbug('publisherId -> ' . $publisherId);
     preg_match_all('@/([0-9]+)/([0-9]+)/@i', $this->web, $match);
     $elem1 = $match[1][0];
     $elem2 = $match[2][0];
     $a_encodear_2 = array('target' => 'com.brightcove.player.runtime.PlayerMediaFacade.findMediaById', 'response' => '/1', 'data' => array('0' => '1667452d348dee57623638675cb12b6418e7ccc3', '1' => $experienceID, '2' => $elem2, '3' => $publisherId));
     $post = brightcove_encode($a_encodear_2);
     $t = brightcove_curl_web($messagebroker, $post);
     $res_decoded = brightcove_decode($t);
     dbug('SEGUNDA RESPUESTA BRIGHTCOVE (enlaces de vídeos aquí):');
     dbug_r($res_decoded);
     if ($res_decoded['data'] === null) {
         // Seguro que el vídeo no funciona en la página oficial.
         setErrorWebIntera('No se puede reproducir el vídeo desde el enlace que ha indicado.');
         return;
     }
     $base = $res_decoded['data']->getAMFData();
     $titulo = $base['displayName'];
     $imagen = $base['videoStillURL'];
     dbug('titulo = ' . $titulo);
     dbug('imagen = ' . $imagen);
     $obtenido['enlaces'] = brightcove_genera_obtenido($this, $base, array('IOSRenditions' => 'm3u8', 'renditions' => 'rtmpConcreto'), $titulo, array('videoId' => $base['id'], 'pubId' => $publisherId, 'playerId' => $experienceID));
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido, false);
 }