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); }
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); }
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); }
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); }
function calcula() { /* $proxy = '189.174.63.36:8080'; $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,'http://tvnpod.tvolucion.com/indom/delivery/6dd74f0d-18d9-412a-bd59-5071182ffdbd/indom-c120.mp4_970k.mp4'); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_PROXY,$proxy); curl_setopt($ch,CURLOPT_HEADER,1); curl_setopt($ch,CURLOPT_RANGE,'1-200'); $t=curl_exec($ch); if(curl_errno($ch))dbug('Curl error: '.curl_error($ch)); curl_close($ch); dbug_($t); exit; */ if (enString($this->web, '//m.')) { $this->web = str_replace('//m.', '//www.', $this->web); dbug('Movil -> escritorio'); $this->web_descargada = CargaWebCurl($this->web, '', 0, '', array('Referer: ' . $this->web)); if (!enString($this->web_descargada, '<html')) { $this->web_descargada = CargaWebCurl($this->web); } } //usarse a sí mismo como réferer if (!enString($this->web_descargada, '<html')) { $this->web_descargada = CargaWebCurl($this->web, '', 0, '', array('Referer: ' . $this->web)); } if (!enString($this->web_descargada, '<html')) { $this->web_descargada = CargaWebCurl($this->web); } //dbug_($this->web_descargada); $obtenido = array('enlaces' => array()); //para televisa.com/novelas if (stringContains($this->web_descargada, array('showVideo(', 'data-idvideo="', 'embed.php?id='))) { if (enString($this->web_descargada, 'showVideo(')) { dbug('-1-'); preg_match('@showVideo\\(([0-9]+)\\)@', $this->web_descargada, $match); } elseif (enString($this->web_descargada, 'data-id="')) { dbug('-2-'); preg_match('@data-id="([0-9]+)"@', $this->web_descargada, $match); } elseif (enString($this->web_descargada, 'data-idvideo="')) { dbug('-2.5-'); preg_match('@data-idvideo="([0-9]+)"@', $this->web_descargada, $match); } elseif (enString($this->web_descargada, 'embed.php?id=')) { dbug('-3-'); preg_match('@embed.php\\?id=([0-9]+)@', $this->web_descargada, $match); } if (isset($match[1])) { $idVideo = $match[1]; dbug($idVideo); // $this->web='http://amp.televisa.com/embed/embed.php?id='.$idVideo.'&w=620&h=345'; $this->web = 'http://tvolucion.esmas.com/embed/embed.php?id=' . $idVideo . '&w=620&h=345'; $this->web_descargada = CargaWebCurl($this->web, '', 0, '', array('Referer: ' . $this->web)); if (enString($this->web_descargada, 'ya no se encuentra disponible')) { setErrorWebIntera('Éste vídeo ya no se encuentra disponible.'); return; } //dbug_($this->web_descargada); } } if (enString($this->web_descargada, 'params_dvr.json')) { if (!isset($idVideo)) { preg_match('#/([0-9]+?)/params_dvr.json#', $this->web_descargada, $matches); $idVideo = $matches[1]; } $hostname = 'tvolucion.esmas.com'; $json = "http://{$hostname}/tvenvivofiles/{$idVideo}/params_dvr.json"; $json = CargaWebCurl($json); $json = utf8_encode($json); $json = json_decode($json, true); dbug_r($json); $titulo = $json['channel']['item']['title']; $imagen = $json['channel']['item']['media-group']['media-thumbnail']['@attributes']['url']; foreach ($json['channel']['item']['media-group']['media-content'] as &$elem) { if (enString($elem['@attributes']['url'], '.f4m')) { $obtenido['enlaces'][] = array('url' => $elem['@attributes']['url'], 'nombre_archivo' => generaNombreWindowsValido($titulo), 'tipo' => 'f4m'); } elseif (enString($elem['@attributes']['url'], '.m3u8')) { $obtenido['enlaces'][] = array('url' => $elem['@attributes']['url'], 'tipo' => 'm3u8'); } } $obtenido['alerta_especifica'] = 'Es necesario usar un proxy de México. El programa F4M-Downloader permite indicar un proxy.'; } else { //http://c.brightcove.com/services/messagebroker/amf?playerKey=AQ~~,AAAAEUA28vk~,ZZqXLYtFw-ADB2SpeHfBR3cyrCkvIrAe if (enString($this->web_descargada, 'playerKey:"')) { $playerKey = entre1y2($this->web_descargada, 'playerKey:"', '"'); } elseif (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, 'playerID:"')) { $experienceID = entre1y2($this->web_descargada, 'playerID:"', '"'); } elseif (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); if (enString($this->web_descargada, 'videoId:"')) { $contentId = entre1y2($this->web_descargada, 'videoId:"', '"'); } elseif (enString($this->web_descargada, '<param name="videoId"')) { $contentId = entre1y2($this->web_descargada, '<param name="videoId" value="', '"'); } if (!isset($contentId)) { setErrorWebIntera('No se ha encontrado ningún vídeo.'); return; } dbug('contentId -> ' . $contentId); include 'brightcove-funciones.php'; //$aa = 'AAMAAAABAEZjb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkV4cGVyaWVuY2VSdW50aW1lRmFjYWRlLmdldERhdGFGb3JFeHBlcmllbmNlAAIvMQAAAe8KAAAAAgIAKDcyOTBiYTVlOTQzZGM0MmI3ZDY4NmE1NjJmOTZkNWI0MGI0ZjE3OTIRCmNjY29tLmJyaWdodGNvdmUuZXhwZXJpZW5jZS5WaWV3ZXJFeHBlcmllbmNlUmVxdWVzdBlleHBlcmllbmNlSWQhY29udGVudE92ZXJyaWRlcxFUVExUb2tlbhlkZWxpdmVyeVR5cGUTcGxheWVyS2V5B1VSTAVCYrdWAacgAAkDAQqBA1Njb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkNvbnRlbnRPdmVycmlkZRtjb250ZW50UmVmSWRzDXRhcmdldBVmZWF0dXJlZElkE2NvbnRlbnRJZBdjb250ZW50VHlwZRtmZWF0dXJlZFJlZklkFWNvbnRlbnRJZHMZY29udGVudFJlZklkAQYXdmlkZW9QbGF5ZXIFf////+AAAAAFQoo2IT7sSAAEAAEBAQYBBX/////gAAAABmVBUX5+LEFBQUFFVUEyOHZrfixaWnFYTFl0RnctQURCMlNwZUhmQlIzY3lyQ2t2SXJBZQaBGWh0dHA6Ly9ub3RpY2llcm9zLnRlbGV2aXNhLmNvbS9wcm9ncmFtYXMtbm90aWNpZXJvLWNvbi1qb2FxdWluLWxvcGV6LWRvcmlnYS8='; //dbug_r(brightcove_decode(base64_decode($aa))); $a_encodear = array('target' => 'com.brightcove.experience.ExperienceRuntimeFacade.getDataForExperience', 'response' => '/1', 'data' => array('0' => '7290ba5e943dc42b7d686a562f96d5b40b4f1792', '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(new SabreAMF_TypedObject('com.brightcove.experience.ContentOverride', array('contentRefId' => null, 'contentIds' => null, 'featuredRefId' => null, 'contentRefIds' => null, 'contentType' => 0, 'target' => 'videoPlayer', 'featuredId' => NAN, 'contentId' => $contentId)))))))); // FALLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA $post = brightcove_encode($a_encodear); dbug(base64_encode($post)); //dbug_r(brightcove_decode($post)); //dbug_r(brightcove_decode(base64_decode('AAMAAAABAEZjb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkV4cGVyaWVuY2VSdW50aW1lRmFjYWRlLmdldERhdGFGb3JFeHBlcmllbmNlAAIvMQAAAhYKAAAAAgIAKDcyOTBiYTVlOTQzZGM0MmI3ZDY4NmE1NjJmOTZkNWI0MGI0ZjE3OTIRCmNjY29tLmJyaWdodGNvdmUuZXhwZXJpZW5jZS5WaWV3ZXJFeHBlcmllbmNlUmVxdWVzdBlkZWxpdmVyeVR5cGUHVVJMGWV4cGVyaWVuY2VJZCFjb250ZW50T3ZlcnJpZGVzE3BsYXllcktleRFUVExUb2tlbgV/////4AAAAAaBZ2h0dHA6Ly90dm9sdWNpb24uZXNtYXMuY29tL3RlbGVub3ZlbGFzL2RyYW1hL2xhLXJvc2EtZGUtZ3VhZGFsdXBlLzIzNjM0OS9yb3NhLWd1YWRhbHVwZS1wZXF1ZW5hLWdyYW4taGlzdG9yaWEtYW1vci8FQmK3VgGnIAAJAwEKgQNTY29tLmJyaWdodGNvdmUuZXhwZXJpZW5jZS5Db250ZW50T3ZlcnJpZGUNdGFyZ2V0FWZlYXR1cmVkSWQTY29udGVudElkG2ZlYXR1cmVkUmVmSWQVY29udGVudElkcxljb250ZW50UmVmSWQbY29udGVudFJlZklkcxdjb250ZW50VHlwZQYXdmlkZW9QbGF5ZXIFf////+AAAAAFQoNbrQiDiAABAQEBBAAGZUFRfn4sQUFBQUVVQTI4dmt+LFpacVhMWXRGdy1BREIyU3BlSGZCUjNjeXJDa3ZJckFlBgE='))); dbug('a descargar: ' . $messagebroker); $t = brightcove_curl_web($messagebroker, $post); $res_decoded = brightcove_decode($t); dbug_r($res_decoded); $titulo1 = $res_decoded['data']->getAMFData(); $titulo2 = $titulo1['programmedContent']['videoPlayer']->getAMFData(); dbug_r($titulo2); $titulo3 = $titulo2['mediaDTO']->getAMFData(); $titulo = $titulo3['displayName']; //scar todas las URL //preg_match_all('@http(s)?://[a-z0-9A-Z.?/%_=~-]+@i', $t, $match); preg_match_all('@http(s)?://[a-z0-9A-Z./%_-]+@i', $t, $match); //buscar qué URLs son las pics y los vídeos para usarlas dbug_r($match[0]); $imagen = $match[0][1]; $urls_total = count($match[0]); for ($i = 0; $i < $urls_total; $i++) { if (esVideoAudioAnon($match[0][$i])) { $obtenido['enlaces'][] = array('url' => strtr($match[0][$i], array('http://tvnhds.tvolucion.com/z/' => 'http://tvnpod.tvolucion.com/')), 'tipo' => 'http'); } } } $obtenido['titulo'] = $titulo; $obtenido['imagen'] = $imagen; finalCadena($obtenido, false); }
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); }
function calcula() { $obtenido = array('enlaces' => array()); // https://www.toons.tv/channels/Angry_Birds_Toons/2836878488001 // $contentId = 2836878488001; preg_match("@/([0-9]*?)\$@", $this->web, $matches); dbug_r($matches); $contentId = $matches[1]; $playerID = 2575783636001; $playerKey = "AQ~~,AAAB4eGoB7k~,qFXAwsXF0CNH_yigPCPuBhmMwKcWfpTc"; include 'brightcove-funciones.php'; //2836878488001 /* $lol = "AAMAAAABAEZjb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkV4cGVyaWVuY2VSdW50aW1lRmFjYWRlLmdldERhdGFGb3JFeHBlcmllbmNlAAIvMQAABFYKAAAAAgIAKDc1Mzg0ZjZkNmJiMTdmOWJkZDQ0YjgxNTc0ODdiOWE2NGY0MGY2YjQRCmNjY29tLmJyaWdodGNvdmUuZXhwZXJpZW5jZS5WaWV3ZXJFeHBlcmllbmNlUmVxdWVzdBlkZWxpdmVyeVR5cGUTcGxheWVyS2V5B1VSTBlleHBlcmllbmNlSWQhY29udGVudE92ZXJyaWRlcxFUVExUb2tlbgV/////4AAAAAZlQVF+fixBQUFCNGVHb0I3a34scUZYQXdzWEYwQ05IX3lpZ1BDUHVCaG1Nd0tjV2ZwVGMGimdodHRwczovL3NhZG1pbi5icmlnaHRjb3ZlLmNvbS92aWV3ZXIvdXMyMDE0MDEzMC4xMzIwL0JyaWdodGNvdmVCb290bG9hZGVyLnN3Zj9wbGF5ZXJJRD0yNTc1NzgzNjM2MDAxJnBsYXllcktleT1BUSU3RSU3RSUyQ0FBQUI0ZUdvQjdrJTdFJTJDcUZYQXdzWEYwQ05IX3lpZ1BDUHVCaG1Nd0tjV2ZwVGMmc2VjdXJlQ29ubmVjdGlvbnM9dHJ1ZSZwdXJsPWh0dHBzJTNBJTJGJTJGd3d3LnRvb25zLnR2JTJGY2hhbm5lbHMlMkZBbmdyeV9CaXJkc19Ub29ucyUyRjI4MzY4Nzg0ODgwMDEmYXV0b1N0YXJ0PSZiZ2NvbG9yPSUyMzQ5NDk0OSZkZWJ1Z2dlcklEPSZkeW5hbWljU3RyZWFtaW5nPXRydWUmZmxhc2hJRD1teUV4cGVyaWVuY2UmaGVpZ2h0PTM2MCZodG1sRGVmYXVsdEJpdHJhdGU9ODk2MDAwJmluY2x1ZGVBUEk9dHJ1ZSZpc1VJPXRydWUmaXNWaWQ9dHJ1ZSZvcmlnaW5hbFRlbXBsYXRlUmVhZHlIYW5kbGVyPUJDTC5vblRlbXBsYXRlUmVhZHkmc2VjdXJlSFRNTENvbm5lY3Rpb25zPXRydWUmc3RhcnRUaW1lPTEzOTE0NjU2ODk4NzYmdGVtcGxhdGVMb2FkSGFuZGxlcj1CQ0wub25UZW1wbGF0ZUxvYWQmdGVtcGxhdGVSZWFkeUhhbmRsZXI9YnJpZ2h0Y292ZSU1QiUyMnRlbXBsYXRlUmVhZHlIYW5kbGVybXlFeHBlcmllbmNlJTIyJTVEJnZpZGVvSUQ9MjgzNjg3ODQ4ODAwMSZ3aWR0aD02NDAmd21vZGU9b3BhcXVlBUKCvcVZYQgACQMBCoEDU2NvbS5icmlnaHRjb3ZlLmV4cGVyaWVuY2UuQ29udGVudE92ZXJyaWRlFWZlYXR1cmVkSWQTY29udGVudElkG2ZlYXR1cmVkUmVmSWQVY29udGVudElkcxljb250ZW50UmVmSWQNdGFyZ2V0G2NvbnRlbnRSZWZJZHMXY29udGVudFR5cGUFf////+AAAAAFQoSkGROOCAABAQEGF3ZpZGVvUGxheWVyAQQABgE="; $lol = base64_decode($lol); dbug_r(brightcove_decode($lol)); */ //http://c.brightcove.com/services/messagebroker/amf?playerKey=AQ~~,AAAAEUA28vk~,ZZqXLYtFw-ADB2SpeHfBR3cyrCkvIrAe $messagebroker = "https://secure.brightcove.com/services/messagebroker/amf?playerKey=" . $playerKey; $a_encodear = array("target" => "com.brightcove.experience.ExperienceRuntimeFacade.getDataForExperience", "response" => "/1", "data" => array("0" => "75384f6d6bb17f9bdd44b8157487b9a64f40f6b4", "1" => new SabreAMF_AMF3_Wrapper(new SabreAMF_TypedObject("com.brightcove.experience.ViewerExperienceRequest", array("deliveryType" => NAN, "playerKey" => $playerKey, "URL" => $this->web, "experienceId" => $playerID, "contentOverrides" => array("0" => new SabreAMF_TypedObject("com.brightcove.experience.ContentOverride", array("featuredId" => NAN, "contentId" => $contentId, "featuredRefId" => null, "contentIds" => null, "contentRefId" => null, "target" => "videoPlayer", "contentRefIds" => null, "contentType" => 0))), "TTLToken" => null))))); $post = brightcove_encode($a_encodear); 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); // http://roviohdhd-f.akamaihd.net/hd/2069665155001/2069665155001_28369,42536,43153,38732,39126,001_ABT-E0530-SLUMBERMILL-Panama-MASTER.mp4.csmil/bitrate=3?videoId=2836878488001&lineUpId=&pubId=2069665155001&playerId=2575783636001&affiliateId=&v=&fp=&r=&g= $base = $res_decoded["data"]->getAMFData(); $base2 = $base["programmedContent"]["videoPlayer"]->getAMFData(); $base3 = $base2["mediaDTO"]->getAMFData(); $titulo = $base3["shortDescription"]; $imagen = $base3["videoStillURL"]; dbug('titulo = ' . $titulo); dbug('imagen = ' . $imagen); $mediaId = $base2["mediaId"]; dbug('mediaId = ' . $mediaId); // http://roviohdhd-f.akamaihd.net/hd/2069665155001/2069665155001_28369,42536,43153,38732,39126,001_ABT-E0530-SLUMBERMILL-Panama-MASTER.mp4.csmil/bitrate=3?videoId=2836878488001&lineUpId=&pubId=2069665155001&playerId=2575783636001&affiliateId=&v=&fp=&r=&g= $finalURL = '.csmil/bitrate=3?videoId=' . $mediaId . '&pubId=&playerId=&v=&fp=&r=&g='; $aPartir = array(); $URLBase = ''; $inicio = 0; dbug('renditions'); $renditions = $base3["renditions"]; for ($i = 0, $i_t = count($renditions); $i < $i_t; $i++) { $temp = $renditions[$i]->getAMFData(); $URLBase = $temp["defaultURL"]; $inicio = strpos($URLBase, '_') + 1; $final = strpos($URLBase, '_', $inicio); $n1 = substr($URLBase, $inicio, 5); $n2 = substr($URLBase, $inicio + 5, 5); $n3 = substr($URLBase, $inicio + 10, 3); $aPartir[] = substr($URLBase, $inicio, $final - $inicio); } dbug_r($aPartir); dbug('$URLBase => ' . $URLBase); $principio = substr($URLBase, 0, $inicio); $inicio2 = strpos($URLBase, '_', $inicio); $final = substr($URLBase, $inicio2); dbug('$principio => ' . $principio); dbug('$final => ' . $final); dbug('$finalURL => ' . $finalURL); //Se supone que todos son igual de largos. Los número separados por comas se formar a partir de el inicio común de todos como primer número, el final común como último número, y los intermedios son lo que cambia. /* Las siguientes son todas URL válidas: http://telemadridhdhd-f.akamaihd.net/hd/104403117001/104403117001_28405,62175,77044,77622,001_e9b9daed-e008-470c-b1d4-6463de1bb823.mp4.csmil/bitrate=2?videoId=2840532536001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=&bandwidthEstimationTest=true&v=3.1.0&fp=WIN%2011,9,900,170&r=PBMXA&g=DBNLQTFOYOHN http://telemadridhdhd-f.akamaihd.net/hd/104403117001/104403117001_284,05621750,05770440,05776220,01_e9b9daed-e008-470c-b1d4-6463de1bb823.mp4.csmil/bitrate=2?videoId=2840532536001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=&bandwidthEstimationTest=true&v=3.1.0&fp=WIN%2011,9,900,170&r=PBMXA&g=DBNLQTFOYOHN http://telemadridhdhd-f.akamaihd.net/hd/104403117001/104403117001_,2840562175001,2840577044001,2840577622001,_e9b9daed-e008-470c-b1d4-6463de1bb823.mp4.csmil/bitrate=2?videoId=2840532536001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=&bandwidthEstimationTest=true&v=3.1.0&fp=WIN%2011,9,900,170&r=PBMXA&g=DBNLQTFOYOHN */ $obtenido['enlaces'] = array(array('url_txt' => 'Descargar', 'url' => $principio . ',' . implode(',', $aPartir) . ',' . $final . $finalURL, 'tipo' => 'http', 'extension' => 'mp4')); $obtenido['titulo'] = $titulo; $obtenido['imagen'] = $imagen; finalCadena($obtenido, false); }
<?php include_once '../../secundario/brightcove-funciones.php'; ?> <form method="post" action=""> AMF (Base64_encoded):<br/><textarea name="a" cols="100" rows="10"><?php echo isset($_POST["a"]) ? $_POST["a"] : ''; ?> </textarea> <br/><br/> Texto plano:<br/><textarea name="b" cols="100" rows="10"><?php var_dump(isset($_POST["a"]) ? brightcove_decode(base64_decode($_POST["a"])) : ''); ?> </textarea> <br/> <input type="submit" value="Calcular"> </form />
function calcula() { $obtenido = array('enlaces' => array()); if (enString($this->web_descargada, '<param name="publisherID"')) { $publisherId = entre1y2($this->web_descargada, '<param name="publisherID" value="', '"'); } if (!isset($publisherId)) { setErrorWebIntera('No se ha encontrado ningún vídeo.'); return; } if (enString($this->web_descargada, '<param name="@videoPlayer"')) { $contentId = entre1y2($this->web_descargada, '<param name="@videoPlayer" value="', '"'); } if (!isset($contentId)) { setErrorWebIntera('No se ha encontrado ningún vídeo.'); return; } 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('$publisherId -> ' . $publisherId); dbug('$contentId -> ' . $contentId); dbug('experienceID = playerId -> ' . $experienceID); $messagebroker = 'http://c.brightcove.com/services/messagebroker/amf?playerId=' . $experienceID; include 'brightcove-funciones.php'; /* $lol="AAMAAAABAEZjb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkV4cGVyaWVuY2VSdW50aW1lRmFjYWRlLmdldERhdGFGb3JFeHBlcmllbmNlAAIvMQAAAcsKAAAAAgIAKDBhMGVmYTdhMTBjMTg2M2IyZjk5MmE2MGQ3MjJiYTlkNDExMzg4NGQRCmNjY29tLmJyaWdodGNvdmUuZXhwZXJpZW5jZS5WaWV3ZXJFeHBlcmllbmNlUmVxdWVzdCFjb250ZW50T3ZlcnJpZGVzE3BsYXllcktleRFUVExUb2tlbhlkZWxpdmVyeVR5cGUHVVJMGWV4cGVyaWVuY2VJZAkDAQqBA1Njb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkNvbnRlbnRPdmVycmlkZRtmZWF0dXJlZFJlZklkFWNvbnRlbnRJZHMZY29udGVudFJlZklkF2NvbnRlbnRUeXBlDXRhcmdldBtjb250ZW50UmVmSWRzFWZlYXR1cmVkSWQTY29udGVudElkAQEBBAAGF3ZpZGVvUGxheWVyAQV/////4AAAAAVChKrndlYIAAYBBgEFf////+AAAAAGgTVodHRwOi8vd3d3LnRlbGVtYWRyaWQuZXMvcHJvZ3JhbWFzL21hZHJpbGVub3MtcG9yLWVsLW11bmRvL21hZHJpbGVub3MtcG9yLWVsLW11bmRvLXNpY2lsaWEFQjoHC+3hAAA="; print_r(brightcove_decode(base64_decode($lol))); */ $a_encodear = array('target' => 'com.brightcove.experience.ExperienceRuntimeFacade.getDataForExperience', 'response' => '/1', 'data' => array('0' => '0a0efa7a10c1863b2f992a60d722ba9d4113884d', '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(base64_encode($post)); $t = 'AAMAAAABAEZjb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkV4cGVyaWVuY2VSdW50aW1lRmFjYWRlLmdldERhdGFGb3JFeHBlcmllbmNlAAIvMQAAAa8KAAAAAgIAKDBhMGVmYTdhMTBjMTg2M2IyZjk5MmE2MGQ3MjJiYTlkNDExMzg4NGQRCmNjY29tLmJyaWdodGNvdmUuZXhwZXJpZW5jZS5WaWV3ZXJFeHBlcmllbmNlUmVxdWVzdCFjb250ZW50T3ZlcnJpZGVzEVRUTFRva2VuGWRlbGl2ZXJ5VHlwZRNwbGF5ZXJLZXkHVVJMGWV4cGVyaWVuY2VJZAkDAQqBA1Njb20uYnJpZ2h0Y292ZS5leHBlcmllbmNlLkNvbnRlbnRPdmVycmlkZRtjb250ZW50UmVmSWRzF2NvbnRlbnRUeXBlFWZlYXR1cmVkSWQTY29udGVudElkDXRhcmdldBtmZWF0dXJlZFJlZklkFWNvbnRlbnRJZHMZY29udGVudFJlZklkAQQABX/////gAAAABUKMGgqQeggABhd2aWRlb1BsYXllcgEBAQYBBX/////gAAAABgEGf2h0dHA6Ly93d3cudGVsZW1hZHJpZC5lcy9wcm9ncmFtYXMvcnV0YS0xNzkvcnV0YS0xNzktbGEtY2FicmVyYQVCOgcL7eEAAA=='; dbug_($t); $t = base64_decode($t); $t = brightcove_decode($t); //dbug_r($t); $t = brightcove_encode($t); dbug(base64_encode($t)); $t = brightcove_decode($t); dbug_r($t); exit; */ 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(); $publisherId = $base['publisherId']; $base2 = $base['programmedContent']['videoPlayer']->getAMFData(); $base3 = $base2['mediaDTO']->getAMFData(); $titulo = $base3['shortDescription']; $titulo = limpiaTitulo($titulo); $imagen = $base3['videoStillURL']; dbug('titulo = ' . $titulo); dbug('imagen = ' . $imagen); $mediaId = $base2['mediaId']; dbug('mediaId = ' . $mediaId); dbug('renditions'); $renditions = $base3['renditions']; $t = $renditions[0]->getAMFData(); if (enString($t['defaultURL'], '/hd/')) { // Modo url larga //http://telemadrid-f.akamaihd.net/hd/104403117001/201312/104403117001_2893,100922,090935,103695,001_6760d109-240a-432a-a857-f4434542ea55.mp4.csmil/bitrate=2?videoId=2892867548001&pubId=104403117001&playerId=111787372001&lineUpId=&affiliateId=&bandwidthEstimationTest=true&v=&fp=&r=&g= $finalURL = '.csmil/bitrate=2?videoId=' . $mediaId . '&pubId=' . $publisherId . '&playerId=' . $experienceID . '&v=&fp=&r=&g='; $aPartir = array(); $URLBase = ''; dbug('renditions'); $renditions = $base3['renditions']; for ($i = 0, $i_t = count($renditions); $i < $i_t; $i++) { $temp = $renditions[$i]->getAMFData(); $URLBase =& $temp['defaultURL']; $inicio = strposF($URLBase, '_'); $final = strpos($URLBase, '_', $inicio); $n1 = substr($URLBase, $inicio, 5); $n2 = substr($URLBase, $inicio + 5, 5); $n3 = substr($URLBase, $inicio + 10, 3); $aPartir[] = substr($URLBase, $inicio, $final - $inicio); } dbug_r($aPartir); dbug('$URLBase => ' . $URLBase); $principio = substr($URLBase, 0, $inicio); $inicio2 = strpos($URLBase, '_', $inicio); $final = substr($URLBase, $inicio2); dbug('$principio => ' . $principio); dbug('$final => ' . $final); dbug('$finalURL => ' . $finalURL); //Se supone que todos son igual de largos. Los número separados por comas se formar a partir de el inicio común de todos como primer número, el final común como último número, y los intermedios son lo que cambia. /* Las siguientes son todas URL válidas: http://telemadridhdhd-f.akamaihd.net/hd/104403117001/104403117001_28405,62175,77044,77622,001_e9b9daed-e008-470c-b1d4-6463de1bb823.mp4.csmil/bitrate=2?videoId=2840532536001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=&bandwidthEstimationTest=true&v=3.1.0&fp=WIN%2011,9,900,170&r=PBMXA&g=DBNLQTFOYOHN http://telemadridhdhd-f.akamaihd.net/hd/104403117001/104403117001_284,05621750,05770440,05776220,01_e9b9daed-e008-470c-b1d4-6463de1bb823.mp4.csmil/bitrate=2?videoId=2840532536001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=&bandwidthEstimationTest=true&v=3.1.0&fp=WIN%2011,9,900,170&r=PBMXA&g=DBNLQTFOYOHN http://telemadridhdhd-f.akamaihd.net/hd/104403117001/104403117001_,2840562175001,2840577044001,2840577622001,_e9b9daed-e008-470c-b1d4-6463de1bb823.mp4.csmil/bitrate=2?videoId=2840532536001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=&bandwidthEstimationTest=true&v=3.1.0&fp=WIN%2011,9,900,170&r=PBMXA&g=DBNLQTFOYOHN */ $obtenido['enlaces'] = array(array('url_txt' => 'Descargar', 'url' => $principio . ',' . implode(',', $aPartir) . ',' . $final . $finalURL, 'tipo' => 'http', 'extension' => 'mp4')); } else { $url = array('', 0); for ($i = 0, $i_t = count($renditions); $i < $i_t; $i++) { $temp = $renditions[$i]->getAMFData(); if ($url[1] < $temp['encodingRate']) { $url[0] = $temp['defaultURL']; $url[1] = $temp['encodingRate']; } } dbug('$url => ' . $url[0]); /* rtmpdump -r "rtmp://telemadrid2-bc-od-flashfs.fplive.net:1935/telemadrid2-bc-od-flash?videoId=3712633770001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=" -a "telemadrid2-bc-od-flash?videoId=3712633770001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=" -f "WIN 14,0,0,145" -W "http://admin.brightcove.com/viewer/us20140807.1543/federatedVideoUI/BrightcovePlayer.swf?uid=1407518049436" -p "http://www.telemadrid.es/programas/aqui-en-madrid/aqui-en-madrid-04082014" -y "mp4:rtmp_uds/104403117001/201408/951/104403117001_3712803353001_d721fb63-a0b2-4ec6-a3cf-85641c726e34.mp4?videoId=3712633770001&lineUpId=&pubId=104403117001&playerId=111787372001&affiliateId=" -o 104403117001_371280335 3001_d721fb63-a0b2-4ec6-a3cf-85641c726e34.flv */ /* $dominio = entre1y2($url[0], 'http://','/'); dbug($dominio); //$url[0] = strtr($url[0], array($dominio => 'brightcove04.o.brightcove.com')); */ $andpos = strpos($url[0], '&'); $end = '?videoId=' . $mediaId . '&lineUpId=&pubId=' . $publisherId . '&playerId=' . $experienceID . '&affiliateId='; $r = substr($url[0], 0, $andpos); if ($r[strlen($r) - 1] === '/') { $r = substr($r, 0, strlen($r) - 1); } $obtenido['enlaces'] = array(array('url' => '-', 'rtmpdump' => '-r "' . $r . $end . '" ' . '-y "' . substr($url[0], $andpos + 1) . $end . '"', 'nombre_archivo' => generaNombreWindowsValido($titulo) . '.mp4', 'tipo' => 'rtmpConcreto', 'extension' => 'mp4')); } $obtenido['titulo'] = $titulo; $obtenido['imagen'] = $imagen; finalCadena($obtenido, false); }