Example #1
0
function tvg()
{
    global $web, $web_descargada;
    $retfull = $web_descargada;
    //$retfull=CargaWebCurl($web);
    //debe haber un video
    if (enString($retfull, "flowplayer(")) {
        //netConnectionUrl: "rtmp://media1.crtvg.es:80/vod" //Para VOD
        $p = strpos($retfull, 'netConnectionUrl: "') + 19;
        $f = strpos($retfull, '"', $p);
        $ret = substr($retfull, $p, $f - $p);
        dbug($ret);
        //clip: {
        //url: "mp4:02/0000/0000_20121206000000.mp4",
        $clip = strpos($retfull, 'clip: {');
        $p = strpos($retfull, 'url: "', $clip) + 6;
        $f = strpos($retfull, '"', $p);
        $ret = $ret . '/' . substr($retfull, $p, $f - $p);
        dbug($ret);
        //title: "Tourilandia recibe a visita de David Vidal",
        $p = strpos($retfull, 'title: "', $clip) + 8;
        $f = strpos($retfull, '"', $p);
        $titulo = substr($retfull, $p, $f - $p);
        $titulo = limpiaTitulo($titulo);
        dbug('titulo=' . $titulo);
        //imagen
        //backgroundImage: "url(http://www.crtvg.es/files/web/000020121206000000.jpg)"
        $p = strpos($retfull, 'backgroundImage: "url(') + 22;
        $f = strpos($retfull, ')', $p);
        $imagen = substr($retfull, $p, $f - $p);
        dbug('imagen=' . $imagen);
    }
    $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $ret, 'tipo' => 'rtmp')));
    finalCadena($obtenido);
}
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     //raido o tv
     if (enString($this->web_descargada, "#radio")) {
         $p = strpos($this->web_descargada, 'http://podcastdl.');
         $f = strpos($this->web_descargada, '"', $p);
         $ret = substr($this->web_descargada, $p, $f - $p);
         dbug('url=' . $ret);
         array_push($obtenido['enlaces'], array('url' => $ret, 'tipo' => 'http'));
         $imagen = entre1y2($this->web_descargada, '<div class="imagen"><img src="', '"');
         dbug('imagen=' . $imagen);
     }
     if (enString($this->web_descargada, "#tv")) {
         $rtmp = 'rtmp://' . entre1y2($this->web_descargada, 'rtmp://', '"');
         if (enString($rtmp, "#")) {
             $f = strpos($rtmp, '#');
             if (enString($rtmp, "#tv")) {
                 $f = strpos($rtmp, '#', $f + 1);
             }
             $rtmp = substr($rtmp, 0, $f);
         }
         $rtmp = strtr($rtmp, array("#" => ""));
         dbug('rtmp=' . $rtmp);
         //if(isiPad)
         $http = entre1y2($this->web_descargada, 'if(isiPad)', '</script>');
         //poster="/sites/default/files/extremaduranoticas_nuevo2.jpg"
         $imagen = "http://www.canalextremadura.es" . entre1y2($http, 'poster="', '"');
         dbug('imagen=' . $imagen);
         $http = entre1y2($http, 'src="', '"');
         array_push($obtenido['enlaces'], array('titulo' => 'Calidad Baja', 'url' => $http, 'tipo' => 'http'));
         array_push($obtenido['enlaces'], array('titulo' => 'Calidad Alta', 'url' => $rtmp, 'tipo' => 'rtmp'));
     }
     if (enString($this->web_descargada, ".mp4#")) {
         $rtmp = 'rtmp://' . entre1y2($this->web_descargada, 'rtmp://', '.mp4') . '.mp4';
         dbug('rtmp=' . $rtmp);
         //if(isiPad)
         $http = entre1y2($this->web_descargada, 'data-iosUrl="', '"');
         //poster="/sites/default/files/extremaduranoticas_nuevo2.jpg"
         $imagen = "http://www.canalextremadura.es/" . entre1y2($http, '#/', "#");
         dbug('imagen=' . $imagen);
         //if(isiPad)
         $http = "http://" . entre1y2($http, 'http://', '#');
         array_push($obtenido['enlaces'], array('titulo' => 'Calidad Baja', 'url' => $http, 'url_txt' => 'Descargar', 'tipo' => 'http'));
         array_push($obtenido['enlaces'], array('titulo' => 'Calidad Alta', 'url' => $rtmp, 'tipo' => 'rtmp'));
     }
     //<h1 class="title">Extremadura 2 (17/05/12)</h1>
     if (enString($this->web_descargada, '<h1 class="title">')) {
         $titulo = entre1y2($this->web_descargada, '<h1 class="title">', '</h1>');
     } else {
         $p = strpos($this->web_descargada, '.mp4');
         $p = strpos($this->web_descargada, '<a', $p);
         $titulo = entre1y2_a($this->web_descargada, $p, '>', '</');
     }
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido);
 }
Example #3
0
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     if (strpos($this->web, 'http://player.vimeo.com/video/') === 0) {
         $ret = desde1a2($this->web_descargada, '{"', ';');
         $json_respuesta = json_decode($ret, true);
     } else {
         $ret = CargaWebCurl('http://player.vimeo.com/video/' . html_entity_decode(entre1y2($this->web_descargada, 'http://player.vimeo.com/video/', '"')));
         $json_respuesta = json_decode($ret, true);
     }
     dbug_r($json_respuesta);
     $opciones = $json_respuesta['request']['files']['h264'];
     dbug_r($opciones);
     if (count($opciones) == 3 && isset($opciones['mobile']) && isset($opciones['hd']) && isset($opciones['sd'])) {
         $obtenido['enlaces'][] = array('url' => $opciones['hd']['url'], 'url_txt' => "Calidad: Alta", 'tipo' => 'http');
         $obtenido['enlaces'][] = array('url' => $opciones['sd']['url'], 'url_txt' => "Calidad: Media", 'tipo' => 'http');
         $obtenido['enlaces'][] = array('url' => $opciones['mobile']['url'], 'url_txt' => "Calidad: Baja", 'tipo' => 'http');
     } else {
         foreach ($opciones as $index => $elem) {
             $obtenido['enlaces'][] = array('url' => $elem['url'], 'url_txt' => "Calidad: " . $index, 'tipo' => 'http');
         }
     }
     $titulo = $json_respuesta['video']['title'];
     $titulo = limpiaTitulo($titulo);
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = current($json_respuesta['video']['thumbs']);
     finalCadena($obtenido);
     return $obtenido;
 }
Example #4
0
 function calcula()
 {
     $enlace = array();
     //&file=media/53/Video/10/1/10107_BAJA.mp4&
     //file
     $file = entre1y2($this->web_descargada, 'file=', '&');
     //image=http://mediateca.regmurcia.com/MediatecaCRM/ServletLink?METHOD=MEDIATECA%26accion=imagen%26id=10107
     $p = strrposF($file, '/');
     $f = strpos($file, '_', $p);
     $imagen = 'http://mediateca.regmurcia.com/MediatecaCRM/ServletLink?METHOD=MEDIATECA&accion=imagen&id=' . substr($file, $p, $f - $p);
     //&title=Metros cuadrados&
     $titulo = utf8_encode(entre1y2($this->web_descargada, '&title=', '&'));
     $titulo = limpiaTitulo($titulo);
     //&description=Programa nº 62.
     $descripcion = utf8_encode(entre1y2($this->web_descargada, '&description=', "'"));
     $descripcion = limpiaTitulo($descripcion, 300);
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'descripcion' => $descripcion, 'enlaces' => array());
     //server
     $server = entre1y2($this->web_descargada, 'streamer=', '&');
     $tipo = "http";
     if (enString($server, 'rtmp')) {
         $server = substr($server, 0, strrpos($server, '/'));
         $file = 'mp4:' . $file;
         $obtenido['enlaces'][] = array('url' => '-', 'rtmpdump' => '-r "' . $server . '" -y "' . $file . '"', 'nombre_archivo' => generaNombreWindowsValido($titulo . '.mp4'), 'tipo' => 'rtmpConcreto');
     } elseif (enString($server, 'http')) {
         $obtenido['enlaces'][] = array('url' => $server . '/' . $file, 'tipo' => 'http');
     }
     finalCadena($obtenido, true);
 }
Example #5
0
 function calculacom()
 {
     //titulo
     //<meta property="og:title" content="Alaska y Mario Episodio Extra - Pierrot"/>
     $p = strpos($this->web_descargada, 'og:title');
     $titulo = entre1y2_a($this->web_descargada, $p, 'content="', '"');
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     //imagen
     //<meta property="og:image" content="http://....jpg?height=106&amp;quality=0.91"/>
     $p = strpos($this->web_descargada, 'og:image');
     $imagen = entre1y2_a($this->web_descargada, $p, 'content="', '?');
     if (enString($imagen, 'mtvnimages.com')) {
         $imagen = $imagen . '?height=180&quality=1';
     } else {
         $imagen = substr($imagen, 0, strpos($imagen, '"'));
     }
     dbug('imagen=' . $imagen);
     //en la página
     /*
     http://www.eitb.com/es/videos/detalle/1258848/video-meteorito-rusia--mas-100-heridos-al-caer-meteorito/
     detalle_video_1258848
     http://www.eitb.com/es/get/multimedia/video/id/1258848/size/grande/
     <media:content url="http://hdstreameitb-f.akamaihd.net/z/multimediahd/videos/2013/02/15/1045086/20130215_15532024_0005703037_001_001____T1_METEOR.mp4/manifest.f4m" type="video/x-flv"/>
     http://www.eitb.com/multimediahd/videos/2013/02/15/1045086/20130215_15532024_0005703037_001_001____T1_METEOR.mp4
     http://www.eitb.com/multimedia/videos/2011/10/24/558362/PIRINEOS_ES_20111024_101408.flv
     */
     if (preg_match('/<div.+?class="player">/', $this->web_descargada)) {
         if (!enString($this->web_descargada, 'detalle_video_')) {
             setErrorWebIntera('No se puede encontrar ningún vídeo.');
             return;
         }
         $p = strpos($this->web_descargada, '<div class="player">');
         $id = entre1y2_a($this->web_descargada, $p, 'detalle_video_', '"');
         dbug('id=' . $id);
     } elseif (enString($this->web_descargada, 'insertar_player_video(')) {
         $id = entre1y2($this->web_descargada, 'insertar_player_video(', ',');
         dbug('id=' . $id);
     }
     $ret = CargaWebCurl('http://www.eitb.com/es/get/multimedia/video/id/' . $id . '/size/grande/');
     $imagen = entre1y2($ret, 'thumbnail url="', '"');
     if (enString($ret, 'manifest.f4m')) {
         $p = strpos($ret, '<media:content url="');
         //$p=strpos($ret,'url="',$p);
         $url = 'http://www.eitb.com/' . entre1y2_a($ret, $p, 'z/', '/manifest.f4m');
         $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'http')));
     } elseif (enString($ret, '.mp4') || enString($ret, '.flv')) {
         $url = 'http://www.eitb.com/' . entre1y2($ret, '<media:content url="', '"');
         $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'http', 'extension' => substr($url, -3, 3))));
     }
     //a la carta: Ni idea
     /*
     http://www.eitb.tv/es/#/video/2142574288001
     http://www.eitb.tv/es/get/videoplaylist/2142574288001/
     */
     finalCadena($obtenido);
 }
Example #6
0
 function calcula()
 {
     $url = entre1y2($this->web_descargada, 'articuloVideo = "', '"');
     //image=http://mediateca.regmurcia.com/MediatecaCRM/ServletLink?METHOD=MEDIATECA%26accion=imagen%26id=10107
     $imagen = entre1y2($this->web_descargada, 'articuloImagen = "', '"');
     //&title=Metros cuadrados&
     $titulo = entre1y2($this->web_descargada, 'articuloTitulo = "', '"');
     $titulo = limpiaTitulo($titulo);
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'http', 'url_txt' => 'Descargar')));
     finalCadena($obtenido, true);
 }
Example #7
0
 function calcula()
 {
     preg_match('#file:.*"(http.*?.mp4)"#', $this->web_descargada, $matches);
     dbug_r($matches);
     $url = $matches[1];
     $titulo = entre1y2($this->web_descargada, '<h6>', '</h6');
     $titulo = strip_tags($titulo);
     $titulo = limpiaTitulo($titulo);
     $imagen = entre1y2($this->web_descargada, '"og:image" content="', '"');
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'url_txt' => 'Descargar', 'tipo' => 'http')));
     finalCadena($obtenido);
 }
Example #8
0
 function calcula()
 {
     /*
     "clip":{"url":"mp4:/_archivos/videos/web/4334/4334.mp4"}
     "netConnectionUrl":"rtmp://alacarta.aragontelevision.es/vod"
     "playlist":[{"url":"mp4:/_archivos/videos/web/4334/4334.mp4"}]
     
     http://alacarta.aragontelevision.es/_archivos/videos/web/4334/4334.mp4
     */
     $imagen = 'http://www.' . DOMINIO . '/canales/aragontv.png';
     $obtenido = array('enlaces' => array());
     //un solo video
     if (enString($this->web_descargada, 'flowplayer(')) {
         dbug('simple');
         $titulo = entre1y2($this->web_descargada, '<div class="apartado"><h2>', '</h2>');
         $titulo = limpiaTitulo($titulo);
         if (stringContains($titulo, array('</', 'Server:'))) {
             dbug('titulo fallido, usando <title>');
             $titulo = entre1y2($this->web_descargada, '<title>', '</');
             $titulo = limpiaTitulo($titulo);
         }
         dbug('titulo=' . $titulo);
         $obtenido['enlaces'][] = $this->SacarVideo($this->web_descargada, $titulo);
     } elseif (enString($this->web_descargada, 'list-not-even')) {
         dbug('multi');
         $p = strpos($this->web_descargada, '<div class="apartado">');
         $titulo = entre1y2_a($this->web_descargada, $p, '<h2>', '</h2>');
         //en la pagina principal y otras el titulo estará mal, por lo que poner uno genérico
         if (enString($titulo, '<')) {
             $titulo = 'Aragon TV';
         }
         $titulo = limpiaTitulo($titulo);
         dbug('titulo=' . $titulo);
         $videos = substr_count($this->web_descargada, '<span>Ver video</span>');
         dbug('total videos=' . $videos);
         $last = 0;
         for ($i = 0; $i < $videos; $i++) {
             $last = strposF($this->web_descargada, '<div id="idv', $last);
             $url = 'http://alacarta.aragontelevision.es/ajax/ajax.php?id=' . entre1y2_a($this->web_descargada, $last, '_', '"');
             //encontrar ya el titulo del vídeo
             $f = strpos($this->web_descargada, 'fecha', $last);
             $parte = substr($this->web_descargada, $last, $f - $last);
             $p = strrpos($parte, '<a');
             $nombre = entre1y2_a($parte, $p, 'title="', '"');
             $extracto = CargaWebCurl($url);
             $obtenido['enlaces'][] = $this->SacarVideoPorId($extracto, $nombre);
         }
     }
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido, false);
 }
Example #9
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);
 }
Example #10
0
 function calcula()
 {
     //title: "Matalobos quotAno 1 A familiaquot",
     $titulo = entre1y2($this->web_descargada, '<title>', '<');
     if (enString($titulo, ' |')) {
         $titulo = entre1y2($titulo, 0, ' |');
     }
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     if (enString($this->web_descargada, "id=\$(this).attr('id').split('|');")) {
         dbug('modo 1');
         preg_match("#url:.*?'(.*?)',#i", $this->web_descargada, $matches);
         dbug_r($matches);
         $url = $matches[1];
         if ($url[0] === '/') {
             $url = 'http://www.crtvg.es' . $url;
         } else {
             if ($url[0] !== 'h') {
                 $url = substr($this->web, 0, strrposF($this->web, '/')) . $url;
             }
         }
         dbug_r($url);
         preg_match_all("#<div class='cap' id='([0-9]+?)\\|([0-9]+?)'>#", $this->web_descargada, $matches);
         dbug_r($matches);
         $obtenido = array('titulo' => $titulo, 'imagen' => '/canales/tvg.jpg', 'enlaces' => array());
         for ($i = 0, $i_t = count($matches[0]); $i < $i_t; $i++) {
             $ret = CargaWebCurl($url, 'idSerie=' . $matches[1][$i] . '&idCapitulo=' . $matches[2][$i]);
             //dbug_($ret);
             $tit = entre1y2($ret, '<div id="titulo">', '</div');
             $tit = strip_tags($tit);
             $this->parsefragment($obtenido['enlaces'], $ret, $tit, true);
         }
     } else {
         dbug('modo 2');
         //backgroundImage: "url(http://www.crtvg.es/files/web/000020120911000003.jpg)"
         if (enString($this->web_descargada, 'backgroundImage:')) {
             $p = strpos($this->web_descargada, 'backgroundImage:');
             $imagen = entre1y2_a($this->web_descargada, $p, 'url(', ')');
         } else {
             $imagen = entre1y2($this->web_descargada, '"playlist":[{"url":"', '"');
             $imagen = str_replace('\\', '', $imagen);
         }
         dbug('imagen=' . $imagen);
         $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array());
         $this->parsefragment($obtenido['enlaces'], $this->web_descargada, $titulo);
     }
     finalCadena($obtenido);
 }
Example #11
0
 function calcula()
 {
     preg_match("@http://[^ ]*?\\.mp4@i", $this->web_descargada, $matches);
     $url = $matches[0];
     $p = strpos($this->web_descargada, 'property="title"');
     $titulo = entre1y2_a($this->web_descargada, $p, 'content="', '"');
     $titulo = utf8_encode($titulo);
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     //imagen
     $p = strpos($this->web_descargada, 'property="og:image"');
     $imagen = entre1y2_a($this->web_descargada, $p, 'content="', '"');
     dbug('imagen=' . $imagen);
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'http')));
     finalCadena($obtenido);
 }
Example #12
0
 function calcula()
 {
     $retfull = CargaWebCurlProxy($this->web, 'ESP');
     //titulo
     //<meta property="og:title" content="Alaska y Mario Episodio Extra - Pierrot"/>
     $p = strpos($retfull, 'og:title');
     $titulo = entre1y2_a($retfull, $p, 'content="', '"');
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     //imagen
     //<meta property="og:image" content="http://....jpg?height=106&amp;quality=0.91"/>
     $p = strpos($retfull, 'og:image');
     $imagen = entre1y2_a($retfull, $p, 'content="', '?');
     if (enString($imagen, 'mtvnimages.com')) {
         $imagen = $imagen . '?height=180&quality=1';
     } else {
         $imagen = substr($imagen, 0, strpos($imagen, '"'));
     }
     if ($imagen == '' || enString($imagen, '<')) {
         $imagen = entre1y2($retfull, 'rel="image_src" href="', '"');
     }
     dbug('imagen=' . $imagen);
     //vid:"786779",
     $id = entre1y2($retfull, 'vid:"', '"');
     dbug('id=' . $id);
     //http://intl.esperanto.mtvi.com/www/xml/media/mediaGen.jhtml?uri=mgid:uma:video:mtv.es:747606
     $url = 'http://intl.esperanto.mtvi.com/www/xml/media/mediaGen.jhtml?uri=mgid:uma:video:mtv.es:' . $id;
     dbug('url=' . $url);
     $ret = CargaWebCurlProxy($url, 'ESP');
     dbug($ret);
     //Por situación geográfica del servidor (supongo) da error. Usar pydowntv :(
     if (!enString($ret, 'copyright_error.flv')) {
         $extracto = entre1y2($ret, '<rendition', '<beacons>');
         dbug('extracto=' . $extracto);
         $p = strrposF($extracto, '<src>');
         $f = strpos($extracto, '<', $p);
         $url = substr($extracto, $p, $f - $p);
     } else {
         dbug('Usando pydowntv');
         $ret = CargaWebCurl('http://www.pydowntv.com/api?url=' . $this->web);
         dbug($ret);
         $url = entre1y2($ret, '"url_video": ["', '"');
     }
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'rtmpdump' => '-r "' . $url . '" -o "' . generaNombreWindowsValido($titulo) . '.' . (enString($url, '.mp4') ? 'mp4' : 'flv') . '"', 'tipo' => 'rtmpConcreto')));
     finalCadena($obtenido);
 }
Example #13
0
 function calcula()
 {
     if (enString($this->web, '.com/v/')) {
         $this->web = 'https://www.youtube.com/watch?v=' . substr($this->web, strposF($this->web, '.com/v/'));
     }
     $this->web = strtr($this->web, array('//m.' => '//www.'));
     //id
     parse_str(parse_url($this->web, PHP_URL_QUERY), $vars);
     //$id=$vars['v']
     dbug_r($vars);
     $encontrado = false;
     $intentos = 3;
     $tube = new youtube();
     $links = $tube->parse($this->web_descargada);
     dbug_r($links);
     $web2 = $this->web;
     while (($links === false || count($links) == 0) && $intentos > 0) {
         dbug("ERROR: " . $tube->error);
         dbug('reintentando en 0.1s');
         usleep(100000);
         $tube = new youtube();
         $links = $tube->parse(CargaWebCurl($web2, '', 0, '', array(), true, true));
         dbug_r($links);
         --$intentos;
     }
     $obtenido = array('enlaces' => array());
     if ($links) {
         //imagen
         //https://i1.ytimg.com/vi/8GLNKyfdnQg/0.jpg
         $imagen = 'https://i1.ytimg.com/vi/' . $vars['v'] . '/0.jpg';
         $titulo = entre1y2($this->web_descargada, '<meta name="title" content="', '"');
         $titulo = limpiaTitulo($titulo);
         foreach ($links as &$link) {
             //'ext','p','axb','2D-3D','audio','url'
             $obtenido['enlaces'][] = array('url' => $link['url'] . "&title=" . urlencode(decode_entities($titulo)), 'tipo' => 'http', 'url_txt' => $link['p'] . ' ' . $link['ext'] . ($link['2D-3D'] === '3D' ? ': 3D' : '') . ($link['audio'] ? ' - ' . $link['audio'] : ''));
         }
         $obtenido['titulo'] = $titulo;
         $obtenido['imagen'] = $imagen;
         finalCadena($obtenido, false);
     } else {
         setErrorWebIntera($tube->error);
         return;
     }
 }
Example #14
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);
 }
Example #15
0
 function calcula()
 {
     //mirar si hay video
     $obtenido = array();
     if (!enString($this->web_descargada, '_w320.jpg')) {
         return;
     }
     $p = strpos($this->web_descargada, 'og:image');
     $imagen = entre1y2_a($this->web_descargada, $p, 'content="', '"');
     dbug('imagen=' . $imagen);
     $id = entre1y2($imagen, strrposF($imagen, '/'), "_w320.jpg");
     dbug('id=' . $id);
     // Problemas con geobloqueo.
     //$ret=CargaWebCurl(urldecode(entre1y2($this->web_descargada, "'file': '", "'")));
     //$ret=CargaWebCurl('http://www.adnstream.com/get_playlist.php?lista=video&param='.$id);
     $ret = CargaWebCurl('http://proxyanonimo.es/browse.php?u=' . urlencode('http://www.adnstream.com/get_playlist.php?lista=video&param=' . $id) . '&b=12&f=norefer', '', 0, '', array('Referer: http://proxyanonimo.es/'));
     dbug_($ret);
     $titulo = entre1y2($ret, '<title>', '<');
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     $descripcion = entre1y2($ret, '<description>', '<');
     dbug('descripcion=' . $descripcion);
     if (enString($ret, 'hd.file>')) {
         $ret = entre1y2($ret, 'hd.file>', '<');
     } elseif (enString($ret, 'file>')) {
         $ret = entre1y2($ret, 'file>', '<');
     } else {
         $p = strpos($ret, 'http://');
         $f = strpos($ret, '<', $p);
         $ret = substr($ret, $p, $f - $p);
     }
     if (enString($ret, '.flv')) {
         $ret = substr($ret, 0, strrposF($ret, '/')) . $id . '.H264-480p.mp4';
         $ret = 'http://176.31.233.154' . substr($ret, strpos($ret, '/', 10));
     }
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'descripcion' => $descripcion, 'enlaces' => array(array('url' => $ret, 'tipo' => 'http')));
     finalCadena($obtenido);
     return $obtenido;
 }
Example #16
0
 function calcula()
 {
     //get the music_id
     $ari = explode("/", $this->web);
     $v_id = array_pop($ari);
     dbug("http://www.veoh.com/rest/video/" . $v_id . "/details");
     //retrieve xml files
     $this->web_descargada = CargaWebCurl("http://www.veoh.com/rest/video/" . $v_id . "/details");
     $c = strpos($this->web_descargada, "videoId");
     //titulo
     $titulo = entre1y2_a($this->web_descargada, $c, 'title="', '"');
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     //imagen
     $imagen = entre1y2_a($this->web_descargada, $c, 'fullHighResImagePath="', '"');
     dbug('imagen=' . $imagen);
     $url = entre1y2_a($this->web_descargada, $c, 'fullPreviewHashPath="', '"');
     //yell it loud
     $url = trim($url);
     dbug($url);
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'url_txt' => 'Descargar', 'tipo' => 'http')));
     finalCadena($obtenido);
 }
Example #17
0
 function calcula()
 {
     if (preg_match("@playlist[\\s\\S]*?image.*?'([\\s\\S]*?)'[\\s\\S]*?sources[\\s\\S]*?'(http://.*?)'@i", $this->web_descargada, $matches)) {
         dbug_r($matches);
         $url = $matches[2];
         dbug($url);
         $imagen = $matches[1];
         dbug('imagen=' . $imagen);
     } elseif (preg_match("@['\"](https?://.+?token=.+?)['\"]@i", $this->web_descargada, $matches)) {
         dbug_r($matches);
         $url = $matches[1];
         dbug($url);
         preg_match("@thumbail['\"].*?:.*?['\"](.+?)['\"]@i", $this->web_descargada, $matches);
         dbug_r($matches);
         $imagen = $matches[1];
         dbug('imagen=' . $imagen);
     }
     $titulo = entre1y2($this->web_descargada, '<title>', '</title>');
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'url_txt' => 'Descargar', 'tipo' => 'http')));
     finalCadena($obtenido);
 }
Example #18
0
 function calcula()
 {
     dbug('empezando RTVE');
     //si no se pone / al final de un enlace que lo necesita, se arma parda. aplicar la / en caso de que se necesite.
     /*$p=strrpos($this->web,"/");
     if($p!=strlen($this->web)-1){
     	$analisis=substr($this->web,$p);
     	if(!enString($analisis,"."))
     		$this->web.='/';
     }*/
     //modo audio
     //modo infantil
     //modo alacarta
     if (enString($this->web, '/audios/')) {
         dbug('modo audio');
         //$retfull=CargaWebCurl($this->web);
         $audio = 1;
     } elseif (enString($this->web, '/infantil/')) {
         dbug('modo infantil');
         if (strposF($this->web, '/todos') + 2 > strlen($this->web) || !strpos($this->web, '/', strposF($this->web, '/todos') + 2)) {
             $web2 = strtr($this->web, array('/#' => ''));
             $enlaceInfantil = substr($web2, strpos($web2, '/infantil/'));
             dbug('$enlaceInfantil = ' . $enlaceInfantil);
             if (enString($this->web_descargada, $enlaceInfantil)) {
                 preg_match('@(TE_[A-Z]+).*?' . $enlaceInfantil . '@', $this->web_descargada, $matches);
                 dbug_r($matches);
                 $pre_asset = $matches[1];
                 dbug('pre_asset=' . $pre_asset);
                 $pre_asset = 'http://www.rtve.es/infantil/components/' . $pre_asset . '/videos/videos-1.inc';
                 $pre_asset = CargaWebCurl($pre_asset);
                 preg_match('@/([0-9]+?)/@', $pre_asset, $matches);
                 dbug_r($matches);
                 $asset = $matches[1];
                 dbug('asset=' . $asset);
                 /*
                 $titulo = entre1y2($pre_asset, 'title="', '"');
                 dbug('$titulo='.$titulo);
                 $imagen = entre1y2($pre_asset, '<img src="', '"');
                 dbug('$imagen='.$imagen);
                 */
             }
         } else {
             $p = strrposF($this->web, "/", strrposF($this->web, "/") - 2 - strlen($this->web));
             $f = strpos($this->web, "/", $p);
             $asset = substr($this->web, $p, $f - $p);
             dbug('asset=' . $asset);
             if (!is_numeric($asset)) {
                 $preIDURL = entre1y2($this->web_descargada, "/#/", '"');
                 dbug('preIDURL=' . $preIDURL);
                 $p = strpos($preIDURL, "/", strlen($preIDURL) - 12);
                 $asset = entre1y2_a($preIDURL, $p, "/", "/");
                 dbug('asset=' . $asset);
             }
         }
     } else {
         dbug('modo normal');
         //$retfull=CargaWebCurl($this->web);
         //assetID=974036_
         $asset = $this->encuentraAssetEnContenido($this->web_descargada);
     }
     //audio
     if (isset($audio)) {
         dbug('audio');
         //file:'/resources/TE_SENTREN/mp3/0/3/1329728190030.mp3'
         //obtener url (boton descargar en pagina)
         $p = strpos($this->web_descargada, 'class="download"');
         $p = strpos($this->web_descargada, 'href="', $p) + 6;
         $f = strpos($this->web_descargada, '"', $p);
         $ret = substr($this->web_descargada, $p, $f - $p);
         if (!enString($ret, 'http://') || $ret[0] === '/') {
             $ret = 'http://www.rtve.es' . $ret;
         }
         if (enString($ret, '.mp3')) {
             dbug('El mp3 estaba en la web');
         } else {
             dbug('toca sacar el audio por metodo nuevo');
             //$ret=assetdataid
             $p = strposF($this->web_descargada, 'data-assetID="');
             $f = strpos($this->web_descargada, '_', $p);
             $asset = substr($this->web_descargada, $p, $f - $p);
             $ret = $this->convierteID($asset, array('audio', 'video'));
             if ($ret === false) {
                 return;
             }
         }
         dbug('ret=' . $ret);
     } else {
         $ret = $this->convierteID($asset);
         if ($ret === false) {
             return;
         }
         dbug('ret=' . $ret);
     }
     if (isset($asset)) {
         //titulo
         $opciones = array("videos", "audios");
         $sigue = 0;
         $opciones_length = count($opciones);
         for ($i = 0; $i < $opciones_length && !$sigue; $i++) {
             $urlmedia = 'http://www.rtve.es/api/' . $opciones[$i] . '/' . $asset . '/config/mmedia.json';
             dbug('urlmedia=' . $urlmedia);
             $retmedia = CargaWebCurl($urlmedia);
             if (!enString($retmedia, "no existir") && !enString($retmedia, "Informe de Error") && strlen($retmedia) > 0) {
                 $sigue = 1;
             }
         }
         if ($sigue) {
             $sustituir = array('\\"' => "'");
             $retmedia = strtr($retmedia, $sustituir);
             $p = strpos($retmedia, '"title":"') + 9;
             $f = strpos($retmedia, '"', $p);
             $titulo = substr($retmedia, $p, $f - $p);
             $titulo = limpiaTitulo($titulo);
             //imagen
             if (enString($retmedia, '"image":null')) {
                 $imagen = 'http://www.' . DOMINIO . '/canales/rtve.png';
                 dbug('imagen null');
             } else {
                 $p = strpos($retmedia, '"image":"') + 9;
                 $f = strpos($retmedia, '"', $p);
                 $imagen = substr($retmedia, $p, $f - $p);
             }
         } else {
             $titulo = "RTVE";
             $imagen = 'http://www.' . DOMINIO . '/canales/rtve.png';
         }
     } else {
         //titulo
         if (enString($this->web_descargada, '<meta name="audio_title" content="')) {
             $titulo = entre1y2($this->web_descargada, '<meta name="audio_title" content="', '"');
             $imagen = entre1y2($this->web_descargada, '<link rel="image_src" href="', '"');
         } else {
             $p = strpos($this->web_descargada, 'class="header"');
             $p = strpos($this->web_descargada, 'titu', $p);
             $p = strposF($this->web_descargada, '>', $p);
             $f = strpos($this->web_descargada, '<', $p);
             $titulo = substr($this->web_descargada, $p, $f - $p);
             $titulo = limpiaTitulo($titulo);
             //imagen
             $p = strpos($this->web_descargada, 'imgPrograma');
             $p = strposF($this->web_descargada, 'src="', $p);
             $f = strpos($this->web_descargada, '"', $p);
             $imagen = substr($this->web_descargada, $p, $f - $p);
         }
     }
     dbug('titulo=' . $titulo);
     dbug('imagen=' . $imagen);
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $ret, 'tipo' => 'http', 'url_txt' => 'Descargar')));
     if (isset($asset)) {
         // Buscar subtítulos. Tienen extensión .vtt
         $subs = CargaWebCurl('http://www.rtve.es/api/videos/' . $asset . '/subtitulos.json');
         $subs = json_decode($subs, true);
         dbug_r($subs);
         if (isset($subs['page']['items'][0])) {
             foreach ($subs['page']['items'] as $subtitle) {
                 $obtenido['enlaces'][] = array('url' => $subtitle['src'], 'tipo' => 'srt', 'url_txt' => 'Descargar subtítulos (' . $subtitle['lang'] . ')');
             }
             dbug('Agregados subtítulos (' . $subtitle['lang'] . ')');
         }
     }
     $obtenido['alerta_especifica'] = 'Si no funciona el enlace intenta descargarlo de nuevo dentro de varios minutos.';
     finalCadena($obtenido, false);
 }
Example #19
0
 function resuelveIDMetodo2($id, &$enlaces_array, &$titulo, &$imagen, $ignoraCaducados = false)
 {
     //http://www.tv3.cat/pvideo/FLV_bbd_media.jsp?ID=4048670&QUALITY=H&FORMAT=MP4
     $server2 = 'http://www.tv3.cat/pvideo/FLV_bbd_dadesItem.jsp?idint=' . $id;
     dbug('server2=' . $server2);
     $ret = CargaWebCurl($server2);
     dbug('obtenido=' . $ret);
     if (enString($ret, '<title>')) {
         //rectificar titulo
         dbug('rectificar titulo');
         //<h1>Amb Fidel, passi el que passi</h1>
         $titulo = entre1y2($ret, '<title>', '</');
         $titulo = utf8_encode($titulo);
         $titulo = limpiaTitulo($titulo);
         dbug('nuevo titulo=' . $titulo);
     }
     //<format>MP4GES</format>
     //PARA VIDEOS LIMITADOS
     //http://www.tv3.cat/pvideo/FLV_bbd_media.jsp?ID=3932951&QUALITY=H&FORMAT=MP4GES
     if (enString($ret, '<imgsrc>') && !isset($imagen)) {
         $p = strrposF($ret, '<imgsrc>');
         $f = strrpos($ret, '</imgsrc>', $p);
         $imagen = substr($ret, $p, $f - $p);
     }
     $formato = 'MP4';
     if (enString($ret, '<format>')) {
         //ENCUENTRA EL PRIMERO EN LA LISTA; NO EL MEJOR
         dbug('formato encontrado');
         $p = strrposF($ret, '<format>');
         $f = strrpos($ret, '</format>', $p);
         $formato = substr($ret, $p, $f - $p);
     }
     $server3 = 'http://www.tv3.cat/pvideo/FLV_bbd_media.jsp?' . 'ID=' . $id . '&QUALITY=H&FORMAT=' . $formato;
     dbug('server3=' . $server3);
     $server4 = 'http://www.tv3.cat/pvideo/FLV_bbd_media.jsp?' . 'ID=' . $id . '&QUALITY=H&PROFILE=APPMOB&FORMAT=' . $formato;
     dbug('server4=' . $server4);
     $ret = CargaWebCurl($server4);
     dbug('obtenido=');
     dbug_($ret);
     if (enString($ret, 'err.service.expired')) {
         if (!$ignoraCaducados) {
             setErrorWebIntera('El vídeo fue borrado de TV3');
         }
         return;
     } elseif (enString($ret, '<media')) {
         //a sacer el video. si falla la busqueda, entonces hay un error
         //<media videoname="La Costa Brava en caiac/Thalassa/13042012/BB_THALASS">
         //http://mp4-medium-dwn.media.tv3.cat/g/tvcatalunya/0/2/1394113435120.mp4
         //</media>
         $p = strrpos($ret, '<media');
         $ret = entre1y2_a($ret, $p, '>', '<');
         if (enString($ret, 'mp4:') || enString($ret, 'http://')) {
             dbug('urlFinal=' . $ret);
             if (strpos($ret, 'rtmp://') === 0) {
                 $ret = preg_replace('@rtmp://.*?mp4:(.*?)$@', 'http://mp4-medium-dwn.media.tv3.cat/$1', $ret);
                 dbug('urlFinal (mediante preg replace=' . $ret);
             }
             $enlaces_array[] = array('titulo' => 'Calidad media', 'url' => $ret, 'tipo' => 'http');
         }
     }
     $ret = CargaWebCurl($server3);
     dbug('obtenido=');
     dbug_($ret);
     if (enString($ret, '<media')) {
         //http://www.tv3.cat/feeds/videos/fitxaVideo.jsp?id=4874451&device=and-h&format=xml&version=1
         //a sacer el video. si falla la busqueda, entonces hay un error
         //<media videoname="La Costa Brava en caiac/Thalassa/13042012/BB_THALASS">
         //rtmp://mp4-500-str.tv3.cat/ondemand/mp4:g/tvcatalunya/2/2/1334322726322.mp4
         //</media>
         $p = strrpos($ret, '<media');
         $ret = entre1y2_a($ret, $p, '>', '<');
         if (enString($ret, 'mp4:')) {
             preg_match('@^(.*?/)(mp4:.*?)$@', $ret, $matches);
             dbug_r($matches);
             // 4/09/2012 metodo rectificado
             dbug('urlFinal=' . $ret);
             $enlaces_array[] = array('titulo' => 'Calidad alta', 'url' => $ret, 'rtmpdump' => '-r "' . $matches[1] . '" -y "' . $matches[2] . '" -o "' . generaNombreWindowsValido($titulo) . '.mp4"', 'tipo' => 'rtmpConcreto', 'extension' => 'mp4');
         } else {
             // 2/06/2014
             dbug('urlFinal=' . $ret);
             $ext = substr($ret, -3, 3);
             $enlaces_array[] = array('url' => $ret, 'rtmpdump' => '-r "' . $ret . '" -o "' . generaNombreWindowsValido($titulo) . '.' . $ext . '"', 'tipo' => 'rtmpConcreto', 'extension' => '.' . $ext);
         }
     }
 }
Example #20
0
 function calcula()
 {
     //Hay videos geobloqueados. pocos pero hay. OJO porque no irán
     /*
     POST a:
     es.medici.tv
     
     con:
     json=true&page=%2Fhenri-demarquette-charles-dutoit-royal-philharmonic-orchestra-annecy-classic-festival-2012&timezone_offset=-120
     */
     //comprobar que la web es correcta o fallar
     if (!enString($this->web, '#!')) {
         return;
     }
     $obtenido = array('enlaces' => array());
     //aparentemente se puede. enviemoslo.
     $p = strposF($this->web, '#!');
     $webFormateada = substr($this->web, $p);
     $cabecera = array("Host: es.medici.tv", "Content-type: application/x-www-form-urlencoded");
     $post = 'json=true&page=' . urlencode($webFormateada) . '&timezone_offset=-120';
     $ret = CargaWebCurl('http://es.medici.tv', $post);
     $ret = jsonRemoveUnicodeSequences($ret);
     dbug($ret);
     //imagen:
     //"main_image": "http:....jpg"
     $p = strposF($ret, '"main_image"');
     $p = strposF($ret, '"', $p);
     $f = strpos($ret, '"', $p);
     $imagen = substr($ret, $p, $f - $p);
     dbug('imagen=' . $imagen);
     //titulo:
     //"title": "..."
     $p = strposF($ret, '"title"');
     $p = strposF($ret, '"', $p);
     $f = strpos($ret, '"', $p);
     $titulo = substr($ret, $p, $f - $p);
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     //para las URL:
     //"url_smil": {"1": "http://medias.medici.tv/site/smil/20120822_full_en_1965_def_v2_low.mp4.smil", "3": "http://medias.medici.tv/site/smil/20120822_full_en_1965_def_v2_high.mp4.smil", "2": "http://medias.medici.tv/site/smil/20120822_full_en_1965_def_v2_mid.mp4.smil"}
     // Para url f4m válido agregar al final (&g=&hdcore=)
     if (enString($ret, 'manifest.f4m')) {
         $url_manifest = 'http://medicitvod' . entre1y2($ret, '"http://medicitvod', '"') . '&g=&hdcore=';
         dbug($url_manifest);
         $obtenido['enlaces'][] = array('url' => $url_manifest, 'tipo' => 'f4m', 'nombre_archivo' => generaNombreWindowsValido($titulo));
     } elseif (enString($ret, 'url_smil')) {
         $p2 = strpos($ret, '.mp4');
         $p1 = $p = 0;
         while ($p2 > $p1 && $p1 > -1) {
             $p1 = strpos($ret, '{', $p1 + 1);
             if ($p1 < $p2) {
                 $p = $p1;
             }
         }
         $f = strpos($ret, '}', $p);
         $URLs = substr($ret, $p, $f - $p);
         dbug($URLs);
         $videos = substr_count($URLs, '":');
         dbug('total videos=' . $videos);
         $calidades = array(3 => 'Calidad Alta', 2 => 'Calidad Media', 1 => 'Calidad Baja');
         for ($i = $videos; $i > 0; $i--) {
             //encontrar la url del archivo smil
             $p = strpos($URLs, '"' . $i . '"') + strlen('"' . $i . '"');
             $p = strposF($URLs, '"', $p);
             $f = strpos($URLs, '"', $p);
             $preURL_RTMP = substr($URLs, $p, $f - $p);
             dbug($URLs);
             //cambiar de rtmp a http
             $preURL_HTTP = substr($preURL_RTMP, 0, -1) . "0";
             $URL = $preURL_HTTP;
             $tipo = 'http';
             dbug($URL);
             if ($tipo == 'http') {
                 $obtenido['enlaces'][] = array('url' => $URL, 'tipo' => $tipo, 'url_txt' => $calidades[$i]);
             } else {
                 $obtenido['enlaces'][] = array('titulo' => $calidades[$i], 'url' => $URL, 'tipo' => $tipo);
             }
         }
     }
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido);
 }
Example #21
0
 function univisionID($id)
 {
     dbug('univisionID');
     $ret = 'http://cdn-download.mcm.univision.com/videos_mcm/' . $id . '.js';
     dbug('url=' . $ret);
     $ret = CargaWebCurl($ret);
     if (enString($ret, "Access Denied")) {
         setErrorWebIntera("El vídeo de Univisión está bloqueado.");
         return;
     }
     $obtenido = array('enlaces' => array());
     //imagen
     $imagen = entre1y2($ret, '"src_image_url":"', '"');
     $imagen = strtr($imagen, array('\\' => ''));
     dbug('imagen=' . $imagen);
     //titulo
     $titulo = entre1y2($ret, '"def_title":"', '"');
     $titulo = jsonRemoveUnicodeSequences($titulo);
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     if (!enString($ret, '"published_urls":[]')) {
         dbug('No aparece "published_urls":[]');
         $json = substr($ret, strposF($ret, '('));
         $json = substr($json, 0, strrpos($json, ')'));
         dbug_($json);
         $json = json_decode($json, true);
         dbug_r($json);
         $urls = array();
         if (isset($json['published_urls'])) {
             foreach ($json['published_urls'] as &$url) {
                 if (enString($url['embed_url'], '.mp4')) {
                     $u =& $url['embed_url'];
                     dbug_($u);
                     $p = strrposF($u, '_');
                     $f = strpos($u, '.', $p);
                     $calidad = substr($u, $p, $f - $p);
                     $urls[] = array($u, $calidad);
                 }
             }
         }
         dbug('urls: ' . count($urls));
         //ya tenemos las urls en formato: /120615_2708697_El_Talisman_Capitulo_98_99___Ultimo_capitulo_1339800465_2000.mp4
         //ordenar
         if (count($urls) > 0) {
             $urls = sortmulti($urls, 1, "123", true);
         }
     }
     if (enString($ret, '"published_urls":[]') || isset($urls) && count($urls) === 0) {
         dbug('No se pueden encontrar urls. Usando método 2');
         // http://vmscdn-download.s3.amazonaws.com/videos_mcm/variant/2912557.m3u8
         $m3u8FuenteUrls = 'http://vmscdn-download.s3.amazonaws.com/videos_mcm/variant/' . $id . '.m3u8';
         dbug('$m3u8FuenteUrls = ' . $m3u8FuenteUrls);
         $m3u8FuenteUrls = CargaWebCurl($m3u8FuenteUrls);
         dbug($m3u8FuenteUrls);
         preg_match('@http://.*media(.*?)_[0-9]{3,4}.m3u8@', $m3u8FuenteUrls, $matches);
         dbug_r($matches);
         $urlBase = $matches[1];
         $calidades = array(2000, 1200, 810, 800, 510, 500, 270, 150);
         $urls = array();
         foreach ($calidades as $calidad) {
             $urlT = 'http://h.univision.com/media' . $urlBase . '_' . $calidad . '.mp4';
             $urls[] = array($urlT, $calidad);
         }
         //ya tenemos las urls en formato: /120615_2708697_El_Talisman_Capitulo_98_99___Ultimo_capitulo_1339800465_2000.mp4
         //ya está ordenado
     }
     $urls_length = count($urls);
     for ($i = 0; $i < $urls_length; $i++) {
         if ($urls[$i][1] == 2000) {
             $preContext = array('http' => array('method' => 'HEAD', 'header' => "User-agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0\r\n" . "Connection: close\r\n" . "Accept-Language: es-ES,es;en-US;en\r\n" . "Accept: text/html,application/xhtml+xml,application/xml\r\n", 'timeout' => 5, 'ignore_errors' => '1'));
             $preContext = stream_context_create($preContext);
             if (file_get_contents($urls[$i][0], false, $preContext) === false) {
                 dbug('no se puede abrir la url de calidad 2000');
                 continue;
             }
             dbug_r($http_response_header);
             if (strpos($http_response_header[0], ' 404 ')) {
                 dbug('la url de calidad 2000 da 404');
                 continue;
             }
         }
         if (esVideoAudioAnon($urls[$i][0])) {
             $obtenido['enlaces'][] = array('url' => $urls[$i][0], 'url_txt' => 'Calidad: ' . $urls[$i][1] . " Kbps", 'tipo' => 'http');
         }
     }
     for ($i = 0, $ii = count($json['captions']); $i < $ii; $i++) {
         if ($json['captions'][$i]['language'] === 'es') {
             $url = $json['captions'][$i]['url'];
             $obtenido['enlaces'][] = array('url_txt' => 'Subtítulos en formato ' . substr($url, strrposF($url, '.')), 'url' => $url, 'tipo' => 'srt');
         }
     }
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     $obtenido['alerta_especifica'] = 'Si no puedes descargar el vídeo necesitas usar proxy.<br/>Descarga el programa ultrasurf (<a href="https://ultrasurf.us/download/u.zip">Descargar ultrasurf</a>), descomprime el archivo, ejecuta el programa y una vez hecho intenta descargar el vídeo de nuevo.<br/>Si 2000kbps da error prueba 1200kbps.';
     finalCadena($obtenido, false);
 }
Example #22
0
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     //titulo
     //<meta property="og:title" content="..."
     $p = strpos($this->web_descargada, 'og:title');
     $titulo = entre1y2_a($this->web_descargada, $p, 'content="', '"');
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     //imagen
     //<meta property="og:image" content="....png" />
     $p = strpos($this->web_descargada, 'og:image');
     $imagen = entre1y2_a($this->web_descargada, $p, 'content="', '"');
     dbug('imagen=' . $imagen);
     $posibilidades = array("mp4_hd", "ogv_hd", "mp4_high", "ogv_high", "mp4_med", "ogv_med", "mp4_low", "ogv_low");
     $baseLimpia = $this->agregaSubDominio("");
     $url = "";
     for ($i = 0; $i < 8; $i++) {
         //8 videos
         //url:'mp4%3A%2Fweb%2F4311%2F4311.mp4',
         $p = strpos($this->web_descargada, 'id="' . $posibilidades[$i] . '"');
         $f = strpos($this->web_descargada, ">", $p);
         $url = substr($this->web_descargada, $p, $f - $p);
         $url = $baseLimpia . entre1y2($url, 'src="', '"');
         dbug('url=' . $url);
         if (esVideoAudioAnon($url)) {
             $obtenido['enlaces'][] = array('titulo' => $posibilidades[$i], 'url' => $url, 'tipo' => 'http');
         } else {
             //ya no hay mas videos. fin
             $i = 8;
         }
     }
     if ($this->duda($obtenido, $url)) {
         dbug('intento 0');
         $titulo = entre1y2($this->web_descargada, '<meta property="og:title" content="', '"');
         if (enString($this->web_descargada, 'og:video')) {
             $url = entre1y2($this->web_descargada, '<meta property="og:video" content="', '"');
         }
     }
     if ($this->duda($obtenido, $url)) {
         dbug('intento 1');
         $titulo = "rt.com";
         //video = "..."
         $url2 = $baseLimpia . entre1y2($this->web_descargada, 'video = "', '"');
         if (esVideoAudioAnon($url2)) {
             $url = $url2;
         }
     }
     if ($this->duda($obtenido, $url)) {
         dbug('intento 2');
         $titulo = "rt.com";
         //file=http://actualidad.rt.com/images/programas/123/programas_1636.flv&
         $url2 = $baseLimpia . entre1y2($this->web_descargada, 'file=', '&');
         if (esVideoAudioAnon($url2)) {
             $url = $url2;
         }
     }
     if ($this->duda($obtenido, $url)) {
         dbug('intento 3');
         $titulo = "rt.com";
         //'file': 'http://actualidad.rt.com/images/programas/123/programas_1636.flv'&
         $url2 = $baseLimpia . entre1y2($this->web_descargada, "'file': '", "'");
         if (esVideoAudioAnon($url2)) {
             $url = $url2;
         }
     }
     if ($this->duda($obtenido, $url)) {
         dbug('intento 4');
         $titulo = "rt.com";
         //source src="http://actualidad.rt.com/images/programas/123/programas_1636.flv"
         $url2 = $baseLimpia . entre1y2($this->web_descargada, '<source src="', '"');
         if (esVideoAudioAnon($url2)) {
             $url = $url2;
         }
     }
     if ($this->duda($obtenido, $url)) {
         dbug('intento 5');
         $titulo = "rt.com";
         //video:'/files/news/syria-rebel-massacre-aleppo-627/ie7d56fbec8d0673a34b31e08adb343fe_aleppo-mass-shooting.flv'
         $url2 = $baseLimpia . entre1y2($this->web_descargada, "video:'", "'");
         if (esVideoAudioAnon($url2)) {
             $url = $url2;
         }
     }
     if ($this->duda($obtenido, $url)) {
         dbug('intento 6');
         $titulo = "rt.com";
         //video:'/files/news/syria-rebel-massacre-aleppo-627/ie7d56fbec8d0673a34b31e08adb343fe_aleppo-mass-shooting.flv'
         preg_match('@http://.*?\\.mp4@', $this->web_descargada, $matches);
         dbug_r($matches);
         $url2 = $matches[0];
         if (esVideoAudioAnon($url2)) {
             $url = $url2;
         }
     }
     $obtenido['enlaces'][] = array('url' => $url, 'tipo' => 'http');
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido);
 }
Example #23
0
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     if (enString($this->web_descargada, 'var videos = ')) {
         // var videos = [{"titulo":"Un lugar donde vivir","video":"8965","imagen":"http:\/\/api.rtvcm.webtv.flumotion.com\/videos\/8965\/thumbnail.jpg","fecha":"15\/06\/2015","format_date":"2015-06-15 00:00","descripcion":"Descubrimos los municipios de Cristo del Esp\u00edritu Santo (Ciudad Real) y Vega del Codorno en Cuenca.","fecha-publicacion":"1434404700"},{"titulo":"Un lugar donde vivir","fecha":"08\/06\/2015","format_date":"2015-06-08 00:00","descripcion":"","video":"8738","imagen":"http:\/\/api.rtvcm.webtv.flumotion.com\/videos\/8738\/thumbnail.jpg","fecha-publicacion":""},{"titulo":"Promo Un lugar donde vivir","fecha":"01\/06\/2015","format_date":"2015-06-01 00:00","descripcion":"","video":"8642","imagen":"http:\/\/api.rtvcm.webtv.flumotion.com\/videos\/8642\/thumbnail.jpg","fecha-publicacion":""}];
         // http://play.rtvcm.webtv.flumotion.com/play/player?player=8&pod=8965
         // <meta property=og:title content="Unlugardondevivir15062015.mp4">
         // http://ondemand.rtvcm.ondemand.flumotion.com/rtvcm/ondemand/video/mp4/med/Unlugardondevivir15062015.mp4
         $json = json_decode(entre1y2($this->web_descargada, 'var videos = ', ';'), true);
         if (!isset($json[0])) {
             $json[0] =& $json[''];
             unset($json['']);
         }
         dbug_r($json);
         for ($i = 0, $i_t = count($json); $i < $i_t; $i++) {
             //$video = CargaWebCurl('http://play.rtvcm.webtv.flumotion.com/play/player?player=8&pod=' . $json[$i]['video']);
             // http://api.rtvcm.webtv.flumotion.com/videos/8965/thumbnail.jpg
             // http://media0.ntt.webtv.flumotion.com/cust/rtvcm//outgoingimg/Unlugardondevivir15062015.mp4/Unlugardondevivir15062015.mp4-04.jpg
             // Queremos la redirección de la imagen
             $imgRealUrl = CargaWebCurl($json[$i]['imagen'], '', true, '', array(), false);
             dbug($imgRealUrl);
             $imgRealUrl = entre1y2($imgRealUrl, 'Location: ', "\r");
             dbug($imgRealUrl);
             preg_match('@/([^/]+\\.mp4)@', $imgRealUrl, $matches);
             dbug_r($matches);
             $mp4Url = $matches[0];
             $obtenido['enlaces'][] = array('titulo' => $json[$i]['titulo'] . ' - ' . $json[$i]['fecha'], 'url' => 'http://ondemand.rtvcm.ondemand.flumotion.com/rtvcm/ondemand/video/mp4/med/' . $mp4Url, 'url_txt' => 'Descargar');
         }
         $p = strpos($this->web_descargada, '<title>');
         $titulo = utf8_encode(entre1y2_a($this->web_descargada, $p, ' - ', '<'));
         $titulo = limpiaTitulo($titulo);
         $imagen = 'https://pbs.twimg.com/profile_images/585353307331301377/k1CugBXh_400x400.jpg';
         $obtenido['titulo'] = $titulo;
         $obtenido['imagen'] = $imagen;
         finalCadena($obtenido);
     } else {
         //showVideo(videoURL){
         $p = strpos($this->web_descargada, "showVideo(videoURL){");
         $baseLimpia = entre1y2_a($this->web_descargada, $p, "url: '", "'");
         //showVideo('
         $videos = substr_count($this->web_descargada, "showVideo('");
         $total = array();
         $last = 0;
         for ($i = 0; $i < $videos; $i++) {
             $p = strposF($this->web_descargada, "showVideo('", $last);
             $f = strpos($this->web_descargada, "'", $p);
             $last = $f;
             $vid = $baseLimpia . substr($this->web_descargada, $p, $f - $p);
             dbug('video=' . $vid);
             $tit = entre1y2_a($this->web_descargada, $last, 'title="', '"');
             dbug('tit=' . $tit);
             $total[] = array($vid, utf8_encode($tit));
         }
         for ($i = 0; $i < $videos; $i++) {
             $obtenido['enlaces'][] = array('titulo' => $total[$i][1], 'url' => 'http://ondemand.rtvcm.ondemand.flumotion.com/rtvcm/ondemand/video/mp4/med/' . entre1y2($total[$i][0], 'mp4:'), 'url_txt' => 'Descargar');
         }
         $p = strpos($this->web_descargada, '<title>');
         $titulo = utf8_encode(entre1y2_a($this->web_descargada, $p, ' - ', '<'));
         $titulo = limpiaTitulo($titulo);
         $imagen = 'http://www.rtvcm.es/img/logos_cab_esq.gif';
         $obtenido['titulo'] = $titulo;
         $obtenido['imagen'] = $imagen;
         finalCadena($obtenido);
     }
 }
Example #24
0
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     $imagen = 'http://www.' . DOMINIO . '/canales/goear.png';
     //varias canciones (de un usuario)
     if (enString($this->web_descargada, '<h3>Audios</h3>')) {
         //titulo generico
         $titulo = "Goear";
         $canciones = substr_count($this->web_descargada, 'id="sound_');
         dbug('canciones=' . $canciones);
         $last = 0;
         for ($i = 0; $i < $canciones; $i++) {
             $last = strpos($this->web_descargada, 'id="sound_', $last);
             $id = entre1y2_a($this->web_descargada, $last, 'id="sound_', '"');
             dbug('id ' . $i . '=' . $id);
             $p = strpos($this->web_descargada, '<a', $last);
             $tit = entre1y2_a($this->web_descargada, $p, '>', '</a');
             $tit = strip_tags($tit);
             dbug('tit=' . $tit);
             $mp3 = $this->buscaMP3($id);
             dbug('mp3=' . $mp3);
             array_push($obtenido['enlaces'], array('url' => $mp3, 'tipo' => 'http', 'url_txt' => $tit));
             $last++;
         }
     } elseif (enString($this->web_descargada, "playlistid = '")) {
         $titulo = entre1y2($this->web_descargada, 'title>', '<');
         $titulo = limpiaTitulo($titulo);
         dbug('título=' . $titulo);
         $id = entre1y2($this->web_descargada, "playlistid = '", "'");
         $xml = CargaWebCurl('http://www.goear.com/elplaylist.php?f=' . $id);
         $canciones = substr_count($xml, 'title=');
         dbug('canciones=' . $canciones);
         $last = 0;
         for ($i = 0; $i < $canciones; $i++) {
             $p = strposF($xml, 'path="', $last);
             $f = strpos($xml, '"', $p);
             $last = $f + 2;
             $id = substr($xml, $p, $f - $p);
             dbug('id ' . $i . '=' . $id);
             $tit = entre1y2_a($xml, $last, 'title="', '"');
             $tit = html_entity_decode($tit);
             dbug('tit=' . $tit);
             $mp3 = $this->buscaMP3($id);
             dbug('mp3=' . $mp3);
             array_push($obtenido['enlaces'], array('url' => $mp3, 'tipo' => 'http', 'url_txt' => $tit));
         }
     } elseif (enString($this->web_descargada, "soundid = '")) {
         $titulo = entre1y2($this->web_descargada, 'title>', '<');
         $titulo = limpiaTitulo($titulo);
         dbug('titulo=' . $titulo);
         $id = entre1y2($this->web_descargada, "soundid = '", "'");
         dbug('id=' . $id);
         $mp3 = $this->buscaMP3($id);
         array_push($obtenido['enlaces'], array('url' => $mp3, 'url_txt' => 'Descargar', 'tipo' => 'http'));
     } else {
         setErrorWebIntera('No se ha encontrado ninguna canción');
         return;
     }
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     //no comprobar los enlaces
     finalCadena($obtenido, false);
 }
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     //http://www.canalsuralacarta.es/television/video/presenta-enrique-romero/7718/44
     //video no admitido
     if (enString($this->web_descargada, "_url_xml_datos")) {
         dbug("_url_xml_datos encontrado");
         //<param name="flashVars" value="_width=630&_height=354&_url_xml_datos=http://www.canalsuralacarta.es/webservice/video/7718" />
         //flashVars="_width=630&_height=354&_url_xml_datos="
         $p = strrposF($this->web_descargada, '_url_xml_datos=');
         $f = strpos($this->web_descargada, '"', $p);
         $xml = substr($this->web_descargada, $p, $f - $p);
         dbug("xml=" . $xml);
         //http://www.canalsuralacarta.es/webservice/video/7718
         $titulo = entre1y2($this->web_descargada, '<title>', '<');
         if (enString($titulo, ' ::')) {
             $titulo = substr($titulo, 0, strpos($titulo, ' ::'));
         }
         //$titulo=utf8_encode($titulo);
         $titulo = limpiaTitulo($titulo);
         dbug('titulo=' . $titulo);
         $ret = CargaWebCurl($xml);
         //imagen
         //<archivoMultimediaMaxi><archivo>clipping/2012/02/08/00127/30.jpg</archivo><alt></alt></archivoMultimediaMaxi>
         $imagen = entre1y2($ret, '<picture>', '</');
         dbug('imagen=' . $imagen);
         if (enString($imagen, '1pxtrans.gif')) {
             $imagen = 'http://www.' . DOMINIO . '/canales/canalsur.png';
         }
         //<video type="content">
         //</video>
         $p = strpos($ret, '<video type="content">');
         $ret = substr($ret, $p);
         preg_match_all('#<url>([^\\[]*?)</url>#', $ret, $matches);
         dbug_r($matches[1]);
         dbug('total videos=' . count($matches[1]));
         switch (count($matches[1])) {
             case 0:
                 setErrorWebIntera("No se encuentra ningún vídeo");
                 return;
                 break;
             case 1:
                 $obtenido['enlaces'][] = array('url' => $matches[1][0], 'tipo' => 'http', 'url_txt' => 'Descargar');
                 break;
             default:
                 for ($i = 0, $i_t = count($matches[1]); $i < $i_t; $i++) {
                     $obtenido['enlaces'][] = array('url' => $matches[1][$i], 'tipo' => 'http', 'url_txt' => 'parte ' . ($i + 1));
                 }
                 break;
         }
         //<url>http://ondemand.rtva.ondemand.flumotion.com/rtva/ondemand/flash8/programas/toros-para-todos/20110921122144-7-toros-para-todos-245--domingo.flv</url>
         //http://ondemand.rtva.ondemand.flumotion.com/rtva/ondemand/mp4-web/programas/andalucia-directo/54134_1_6110.mp4
     } elseif (enString($this->web_descargada, "var elementos = [];")) {
         dbug('var elementos = [];');
         $ret = utf8_encode($this->web_descargada);
         $ret = strtr($ret, array('\\"' => "'"));
         $videos = substr_count($ret, 'elementos.push');
         dbug('total videos=' . $videos);
         $last = strpos($ret, "elementos.push");
         $imagen = "http://www.canalsur.es/" . entre1y2_a($ret, $last, '"urlPrevia": "', '"');
         if ($videos > 1) {
             $titulo = "Canal Sur";
             for ($i = 0; $i < $videos; $i++) {
                 $obtenido['enlaces'][$i] = array('url' => entre1y2_a($ret, $last, '"url": "', '"'), 'tipo' => 'http', 'url_txt' => entre1y2_a($ret, $last, '"pie": "', '"'));
                 $last = strpos($ret, "});", $last) + 1;
             }
         } else {
             $titulo = entre1y2_a($ret, $last, '"pie": "', '",');
             $obtenido['enlaces'][$i] = array('url' => entre1y2_a($ret, $last, '"url": "', '"'), 'tipo' => 'http');
         }
     } else {
         dbug('último case ifelse');
         $titulo = utf8_encode(entre1y2($this->web_descargada, '<title>', '<'));
         if (enString($this->web_descargada, "og:image")) {
             $p = strpos($this->web_descargada, "og:image");
             $imagen = entre1y2_a($this->web_descargada, 'content="', '"');
         } else {
             $imagen = 'http://www.' . DOMINIO . '/canales/canalsur.png';
         }
         preg_match("@http://[^ ]*?\\.(?:mp4|flv)@i", $this->web_descargada, $matches);
         $url = $matches[0];
         $obtenido['enlaces'][] = array('url' => $url, 'tipo' => 'http');
     }
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido, 0);
 }
Example #26
0
 function calcula()
 {
     //titulo
     //<p class="fecha">08-05-2012</p>
     //<p class="programa">Objetivo Asturias</p>
     //<meta property="og:title" content=" La Agencia Tributaria inició hace cuatro meses una investigación fiscal en el Montepío de la Minería" />
     $p = strpos($this->web_descargada, 'og:title');
     $titulo = entre1y2_a($this->web_descargada, $p, 'content="', '"');
     $titulo = limpiaTitulo($titulo);
     dbug('titulo=' . $titulo);
     //&image=fotos//11/10/121317639014_Cabecera Objetivo Asturias.jpg&
     //imagen
     $p = strposF($this->web_descargada, "'image':");
     $imagen = entre1y2_a($this->web_descargada, $p, "'", "'");
     dbug('imagen=' . $imagen);
     $p = strposF($this->web_descargada, "'file'");
     $url = entre1y2_a($this->web_descargada, $p, "'", "'");
     dbug($url);
     dbug("A");
     if (!stringContains($url, array(".mp4", ".flv"))) {
         dbug("B");
         // Probemos con la api de json
         $apiURL = "http://rtpa.es/api/muestra_json_vod.php?id_programa=" . entre1y2($this->web_descargada, "id_programa=", "&");
         $apiResp = CargaWebCurl($apiURL);
         dbug($apiResp);
         $apiResp = json_decode($apiResp, true);
         dbug_r($apiResp);
         $imagen = $apiResp['VOD'][0]['url_imagen'];
         dbug('imagen=' . $imagen);
         $titulo = $apiResp['VOD'][0]['nombre_programa'];
         dbug('$titulo=' . $titulo);
         $url = "http://rtpa.ondemand.flumotion.com/rtpa/ondemand/vod/" . $apiResp['VOD'][0]['id_programacion'] . "_1.mp4";
         dbug($url);
         // http://www.rtpa.es/programa:EMBAJADORES_1393094582.html
         // http://rtpa.es/api/muestra_json_vod.php?id_programa=1393094582
         // http://rtpa.ondemand.flumotion.com/rtpa/ondemand/vod/66103_1.mp4?start=0
     }
     //no borrar hasta confirmar que rtpa ya no tiene listas de reproduccion
     /*
     if(enString($retfull,"reproductorVideoOnDemmand-mp4-rtpa.swf")){
     	//<source src="http://asturiastv.eu/vod/2012/04/20120417TPANOTICIAS1_1.mp4" type="video/mp4">
     	$p=strpos($ret,'<source src="')+13;
     	$f=strpos($ret,'"', $p);
     	$ret=substr($ret, $p, $f-$p);
     	//ret ya tiene el enlace. fue rapido
     }
     if(enString($retfull,"reproductorVideoOnDemmand.swf")){
     	//<source src="http://asturiastv.eu/vod/2012/04/20120417TPANOTICIAS1_1.mp4" type="video/mp4">
     	$p=strpos($ret,'partes=')+7;
     	$f=strpos($ret,'&',$p);
     	$partes=substr($ret,$p,$f-$p);
     
     	$files=array();
     
     	for($i=1;$i<$partes+1;$i++){
     		$nvideo="video".$i."=";
     		$p=strpos($retfull,$nvideo,$lastpos)+strlen($nvideo);
     		$f=strpos($retfull,'&',$p);
     		$temp=substr($retfull,$p,$f-$p);
     		$temp='http://195.55.74.217/rtpa/ondemand/vod/'.$temp.'_'.$i.'.mp4';
     		
     		if(esVideoAudioAnon($temp)){
     			$files[]=$temp;
     			dbug('url='.$temp);
     		}
     		else
     			dbug('debería haber una url pero no lo era');
     	}
     	$ret="";
     	foreach($files as $value_display){
     		//echo "</br>".$value_display."</br>";
     		$ret.=$value_display."|";
     	}
     	$ret=substr($ret, 0, -1);
     }
     */
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'http')));
     finalCadena($obtenido);
 }
Example #27
0
 function parseaXMLNormal($url, &$xml_ret, $modo = 'normal')
 {
     dbug('parseaXMLNormal');
     dbug('xml=' . $url);
     $xml = CargaWebCurl($url);
     if ($xml_ret === '') {
         dbug('xml_ret (url)=' . $url);
         $xml_ret = $xml;
     }
     $netStorage = false;
     if (enString($xml, '<NetStorage><![CDATA[')) {
         $ret2 = entre1y2($xml, '<NetStorage><![CDATA[', ']');
         $netStorage = true;
     } else {
         $ret2 = entre1y2($xml, '<urlHttpVideo><![CDATA[', ']');
     }
     //fix para evitar geobloqueo.
     $ret2 = strtr($ret2, array('geodesprogresiva' => 'desprogresiva'));
     $p = strpos($xml, '<archivoMultimedia>');
     $ret = entre1y2_a($xml, $p, '<archivo><![CDATA[', ']');
     //$ret contiene el primer enlace. usandolo podemos saber si hay mas enlaces.
     //sacamos la extension de $ret y suponiendo que todas las partes tienen la misma extension
     //buscamos la existencia del mismo principio y aseguramos con el mismo final
     $extension = substr($ret, strposF($ret, '.'));
     dbug('extensión: ' . $extension);
     if ($extension === 'f4v') {
         dbug('Tiene DRM (ext === f4v). No usar resultado.');
         return array();
     }
     $f = strrposF($ret, '/', 0);
     $baselimpia = substr($ret, 0, $f);
     $lastpos = $total = 0;
     $i = 1;
     $obtenidoT = array();
     while ($total == 0) {
         $p = strpos($xml, '<archivoMultimedia>', $lastpos) + 3;
         $lastpos = $f = strpos($xml, 'archivoMultimedia', $p);
         $rettemp = substr($xml, $p, $f - $p);
         if ($netStorage) {
             $temp = $ret2 . entre1y2($rettemp, '<archivoNetStorage><![CDATA[', ']');
         } else {
             $temp = $ret2 . entre1y2($rettemp, '<archivo><![CDATA[', ']');
         }
         if (enString($temp, $extension)) {
             if ($modo == 'multi') {
                 $urltxt = entre1y2($xml, '<nombre><![CDATA[', ']');
                 if (stringContains($urltxt, array('<', '>'))) {
                     //<title>CarreraBarhein1 </title>
                     $urltxt = entre1y2($xml, '<title>', '<');
                 }
                 $urltxt = limpiaTitulo($urltxt);
             } else {
                 $urltxt = 'parte ' . $i;
             }
             dbug('url encontrada: ' . $temp);
             $obtenidoT[] = array('url' => $temp, 'tipo' => 'http', 'url_txt' => $urltxt);
         } else {
             $total = $i;
         }
         $i++;
     }
     $retornar = array();
     if (count($obtenidoT) > 1) {
         $retornar[] = array('titulo' => 'En partes:');
         foreach ($obtenidoT as $individual) {
             $retornar[] = $individual;
         }
         //añadir la versión del vídeo completa. Gracias a doriape@gmail.com, creador de www.elbarco.tk y www.elbarcoxml.tk
         $retornar[] = array('titulo' => 'Completo:', 'url' => 'rtmp://antena3tvfs.fplive.net/antena3mediateca/' . $baselimpia . '000.' . $extension, 'tipo' => 'rtmp');
     } else {
         if ($modo === 'normal') {
             unset($obtenidoT[0]['url_txt']);
         }
         foreach ($obtenidoT as $elem) {
             $retornar[] = $elem;
         }
     }
     return $retornar;
 }
Example #28
0
 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);
 }