예제 #1
0
 function calcula()
 {
     //titulo
     $titulo = 'LiveLeak';
     dbug('titulo=' . $titulo);
     //imagen
     $imagen = entre1y2($this->web_descargada, 'image: "', '"');
     dbug('imagen=' . $imagen);
     if (enString($this->web_descargada, 'config: "')) {
         $config = entre1y2($this->web_descargada, 'config: "', '"');
         dbug_($config);
         $config = explode('&', $config);
         dbug_r($config);
         $url = '';
         foreach ($config as $elem) {
             if (strpos($elem, 'hd_file_url') === 0) {
                 $url = urldecode(substr($elem, strposF($elem, '=')));
                 break;
             }
             if (strpos($elem, 'file_url') === 0) {
                 $url = urldecode(substr($elem, strposF($elem, '=')));
             }
         }
     } else {
         preg_match('#file: "(http.*?\\.mp4.*?)"#', $this->web_descargada, $matches);
         dbug_r($matches);
         $url = $matches[1];
     }
     dbug_r($url);
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url_txt' => 'Descargar', 'url' => $url, 'tipo' => 'http')));
     finalCadena($obtenido);
 }
예제 #2
0
function emp3world()
{
    global $web;
    $res = CargaWebCurl('http://www.emp3world.com/r.php?submit=Search&phrase=' . urlencode($web));
    //recortar a solo los enlaces
    $p = strposF($res, '<div id="results_box">');
    $f = strpos($res, 'id="right_box"', $p);
    $res = substr($res, $p, $f - $p);
    $resultados = array('buscador' => 'emp3world.com', 'enlaces' => array());
    $p1 = 0;
    for ($i = 0; $i < 10 && ($p1 = strpos($res, 'class="song_item"', $p1)); $i++) {
        $p1++;
        //título
        $p = strposF($res, '<span id="song_title">', $p1);
        $f = strpos($res, '</span', $p);
        $tit = trim(strtr(substr($res, $p, $f - $p) . "@@", array("mp3@@" => "")));
        //url
        $p = strposF($res, 'class="play_link"', $p1);
        $f = strpos($res, "</div", $p);
        $url = substr($res, $p, $f - $p);
        $p = strrposF($url, '<a href="');
        $f = strpos($url, '"', $p);
        $url = substr($url, $p, $f - $p);
        //peso
        $p = strposF($res, 'class="song_size">', $p1);
        $f = strpos($res, "</div", $p);
        $peso = substr($res, $p, $f - $p);
        $peso = trim(strtr($peso, array("MB" => "")));
        $r = array('url' => $url, 'titulo' => $tit, 'peso' => $peso, 'preview' => 1);
        $resultados['enlaces'][] = $r;
    }
    dbug_r($resultados);
    return $resultados;
}
예제 #3
0
 function calcula()
 {
     if (!preg_match('#<form name="F1" method="POST" action=\'\'>#i', $this->web_descargada)) {
         setErrorWebIntera('No se encuentra ningún vídeo');
         return;
     }
     $id = substr($this->web, strposF($this->web, 'allmyvideos.net/'));
     dbug('id = ' . $id);
     $web_embedPlayedTo = 'http://allmyvideos.net/' . $id;
     $retfull = CargaWebCurl($web_embedPlayedTo, '', array('referer' => 'http://web.com'));
     if (enString($retfull, '"image" : "')) {
         $mode = 'lanzaAllMyVideosNet2';
         $imagen = entre1y2($retfull, '"image" : "', '"');
     } else {
         $imagen = '';
         $web_embedPlayedTo = 'http://allmyvideos.net/' . $id;
         $mode = 'lanzaAllMyVideosNet1';
     }
     if (enString($this->web_descargada, 'filename=')) {
         $titulo = entre1y2($this->web_descargada, 'filename=', '"');
         if (enString($titulo, '&')) {
             $titulo = substr($titulo, 0, strpos($titulo, '&'));
         }
         $titulo = urldecode($titulo);
     } else {
         $titulo = 'AllMyVideos ID: ' . $id;
     }
     // FALLA EN EL CALLBACK DEL SWF. EDITAR EL SWF
     $urlJS = 'function lanzaAllMyVideosNet(){' . 'if(typeof DESCARGADOR_ARCHIVOS_SWF === "undefined"){' . 'setTimeout(lanzaAllMyVideosNet, 200)' . '}' . 'else if(DESCARGADOR_ARCHIVOS_SWF === true){' . 'getFlashMovie("descargador_archivos").CargaWeb({' . '"url":"' . $web_embedPlayedTo . '",' . '"metodo":"GET"' . '}, "' . $mode . '");' . '}' . '}' . 'function lanzaAllMyVideosNet1(txt){' . 'var regex = /<input.*?name="(.*?)".*?value="(.*?)".*?>/ig;' . 'var post = "";' . 'var res = [];' . 'while((res = regex.exec(txt)) != null){' . 'if(res[1] === "referer")res[2] = "";' . 'post += res[1] + "=" + res[2] +"&";' . '}' . 'getFlashMovie("descargador_archivos").CargaWeb({' . '"url":"' . $web_embedPlayedTo . '",' . '"metodo":"POST",' . '"post":post' . '}, "lanzaAllMyVideosNet2");' . '}' . 'function lanzaAllMyVideosNet2(txt){' . 'if(txt.indexOf(".setup(") !== -1){' . 'txt = txt.substr(txt.indexOf(".setup("));' . '}' . 'var urls = txt.split("\\"sources\\" : ")[1].split("]")[0]+"]";' . 'var urls = JSON.parse(urls);' . 'urls.sort(function(a,b){return parseInt(a["label"])<parseInt(b["label"])});' . 'url = urls[0]["file"];' . 'mostrarResultado(url);' . '}' . 'function mostrarResultado(entrada){' . 'finalizar(entrada,"Descargar");' . '}' . 'function mostrarFallo(){' . 'finalizar("","Ha ocurrido un error");' . '}' . 'if(typeof descargador_archivos === "undefined"){' . 'D.g("enlaces").innerHTML += \'' . genera_swf_object('/util/fla/f/allmyvideos.net') . '\';' . 'var descargador_archivos = D.g("descargador_archivos");' . '}' . 'lanzaAllMyVideosNet();';
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $urlJS, 'tipo' => 'jsFlash')));
     finalCadena($obtenido);
 }
예제 #4
0
 function calcula()
 {
     $titulo = entre1y2($this->web_descargada, '<title>', '<');
     dbug('titulo = ' . $titulo);
     if (preg_match('@http://media.*?\\.mp4@', $this->web_descargada, $matches)) {
         $imagen = entre1y2_a($this->web_descargada, strposF($this->web_descargada, '"og:image"'), '"', '"');
         dbug('imagen = ' . $imagen);
         $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $matches[0], 'tipo' => 'http')));
     } else {
         preg_match('@#player-container \\.player-display.*?url.*?\'(.*?)\'@', $this->web_descargada, $matches);
         dbug_r($matches);
         $urlPreM3U8 = 'http://www.netd.com' . $matches[1];
         $ret = CargaWebCurl($urlPreM3U8);
         dbug_($ret);
         preg_match('@defaultServiceUrl.*?\'(.*?)\'.*?path.*?\'(.*?)\'@', $ret, $matches);
         dbug_r($matches);
         $url = $matches[1] . '/' . $matches[2];
         dbug('URL = ' . $url);
         preg_match('@preview.*?\'(.*?)\'@', $ret, $matches);
         $imagen = 'http:' . $matches[1];
         dbug('imagen = ' . $imagen);
         $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'm3u8')));
     }
     finalCadena($obtenido);
 }
예제 #5
0
function soso()
{
    global $web;
    $res = CargaWebCurl('http://cgi.music.soso.com/fcgi-bin/m.q?p=1&source=1&t=1&w=' . urlencode($web));
    //recortar a solo los enlaces
    $p = strposF($res, '<div id="results_box">');
    $f = strpos($res, 'id="right_box"', $p);
    $res = substr($res, $p, $f - $p);
    $resultados = array('buscador' => 'soso.com', 'enlaces' => array());
    $p1 = 0;
    for ($i = 0; $i < 20 && ($p1 = strpos($res, 'onmouseover="soso.ie6hover(this,1)"', $p1)); $i++) {
        $p1++;
        //url
        $p = strposF($res, '<td class="data">', $p1);
        $p = strposF($res, 'FI', $p);
        $f = strpos($res, ";", $p);
        $url = substr($res, $p, $f - $p);
        if (!enString($url, "qqmusic.qq.com")) {
            //título
            $p = strposF($res, 'class="s_name">', $p1);
            $f = strpos($res, '</a>', $p);
            $tit = strip_tags(substr($res, $p, $f - $p));
            //peso
            $p = strposF($res, '<td class="size">', $p1);
            $f = strpos($res, "</", $p);
            $peso = substr($res, $p, $f - $p);
            $peso = trim(strtr($peso, array("M" => "")));
            $r = array('url' => $url, 'titulo' => $tit, 'peso' => $peso, 'preview' => 1);
            $resultados['enlaces'][] = $r;
        }
    }
    dbug_r($resultados);
    return $resultados;
}
예제 #6
0
 function calcula()
 {
     $titulo = entre1y2($this->web_descargada, '<title', '<');
     $titulo = substr($titulo, strposF($titulo, '>'));
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array());
     $datos = desde1a2($this->web_descargada, '[["params","', '.forEach');
     dbug_($datos);
     $datos = json_decode($datos, true);
     dbug_r($datos);
     foreach ($datos as $dato) {
         if ($dato[0] === 'params') {
             $datos = urldecode($dato[1]);
             $datos = json_decode($datos, true);
             break;
         }
     }
     dbug_r($datos);
     if (isset($datos['video_data'][0]['hd_src_no_ratelimit'])) {
         $hd = $datos['video_data'][0]['hd_src_no_ratelimit'];
     } elseif (isset($datos['video_data'][0]['hd_src'])) {
         $hd = $datos['video_data'][0]['hd_src'];
     }
     if (isset($hd)) {
         $obtenido['enlaces'][] = array('url_txt' => 'Calidad HD', 'url' => $hd, 'tipo' => 'http');
     }
     if (isset($datos['video_data'][0]['sd_src_no_ratelimit'])) {
         $sd = $datos['video_data'][0]['sd_src_no_ratelimit'];
     } elseif (isset($datos['video_data'][0]['sd_src'])) {
         $sd = $datos['video_data'][0]['sd_src'];
     }
     if (isset($hd)) {
         $obtenido['enlaces'][] = array('url_txt' => 'Calidad SD', 'url' => $sd, 'tipo' => 'http');
     }
     finalCadena($obtenido);
 }
예제 #7
0
 function calcula()
 {
     if (enString($this->web, '&')) {
         $idVideo = entre1y2($this->web, 'v=', '&');
     } else {
         $idVideo = substr($this->web, strposF($this->web, 'v='));
     }
     dbug('idVideo=' . $idVideo);
     //Código
     $titulo = trim(entre1y2($this->web_descargada, '<title>', '</title>'));
     dbug('titulo=' . $titulo);
     $imagen = '';
     /*
     // En caso de que No hubiera bloqueo de IP
     $retfull = CargaWebCurl('http://www.magnovideo.com/player_config.php?mdid='.$idVideo);
     
     
     
     $imagen = entre1y2($retfull,'<tile_thumbs>','</tile_thumbs>');
     dbug('imagen='.$imagen);
     
     
     $video_name = entre1y2($retfull,'<video_name>','</video_name>');
     $sto = entre1y2($retfull,'<sto>','</sto>');
     
     
     $url = substr($imagen, 0, -18).$video_name.'?'.$sto;
     */
     $urlJS = 'function lanzaMagnovideo(){' . 'if(typeof DESCARGADOR_ARCHIVOS_SWF === "undefined"){' . 'setTimeout(lanzaMagnovideo, 200)' . '}' . 'else if(DESCARGADOR_ARCHIVOS_SWF === true){' . 'getFlashMovie("descargador_archivos").CargaWeb({"url":"http://www.magnovideo.com/player_config.php?mdid=' . $idVideo . '"}, "procesaMagnovideo");' . '}' . '}' . 'function procesaMagnovideo(txt){' . 'var imagen = txt.split("<tile_thumbs>")[1].split("</tile_thumbs>")[0];' . 'var video_name = txt.split("<video_name>")[1].split("</video_name>")[0];' . 'var sto = txt.split("<sto>")[1].split("</sto>")[0];' . 'var url = imagen.split("tmpsmall/tiles.jpg")[0] +video_name + "?" + sto;' . 'mostrarResultado(url);' . '}' . 'function mostrarResultado(entrada){' . 'finalizar(entrada,"Descargar");' . '}' . 'function mostrarFallo(){' . 'finalizar("","No se ha encontrado ningún resultado");' . '}' . 'if(typeof descargador_archivos === "undefined"){' . 'D.g("enlaces").innerHTML += \'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" id="descargador_archivos" align="middle">' . '<param name="movie" value="/util/fla/f/ajofeifo.swf" />' . '<param name="quality" value="high" />' . '<param name="bgcolor" value="#000" />' . '<param name="allowScriptAccess" value="sameDomain" />' . '<!--[if !IE]>-->' . '<embed src="/util/fla/f/ajofeifo.swf" quality="high" bgcolor="#000"' . 'width="0" height="0" name="descargador_archivos" align="middle"' . 'play="true" loop="true" quality="high" allowScriptAccess="sameDomain"' . 'type="application/x-shockwave-flash"' . 'pluginspage="http://www.macromedia.com/go/getflashplayer">' . '</embed>' . '<!--<![endif]-->' . '</object>\';' . 'var descargador_archivos = D.g("descargador_archivos");' . '}' . 'lanzaMagnovideo();';
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $urlJS, 'tipo' => 'jsFlash')));
     finalCadena($obtenido);
 }
예제 #8
0
function forshared()
{
    global $web;
    $res = CargaWebCurl('http://search.4shared.com/q/CCQD/1/music/' . urlencode($web));
    //recortar a solo los enlaces
    $p = strposF($res, '"listView res_table"');
    $f = strpos($res, '"writeDragMain"', $p);
    $res = substr($res, $p, $f - $p);
    $resultados = array('buscador' => '4shared.com', 'enlaces' => array());
    $p1 = 0;
    for ($i = 0; $i < 10 && ($p1 = strpos($res, '<tr valign="top" >', $p1)); $i++) {
        $p1++;
        //tamaño
        $p = strposF($res, '<div class="fsize">', $p1);
        $f = strpos($res, '</div>', $p);
        $tam = substr($res, $p, $f - $p);
        $tam = trim(strtr($tam, array("\n" => "", " " => "", "," => "", "KB" => "")));
        $tam = (double) $tam / 1024;
        $tam = substr($tam, 0, strpos($tam, ".") + 2);
        //título
        $p = strpos($res, 'mp3.png', $p1);
        $p = strposF($res, 'title="', $p);
        $f = strpos($res, '"', $p);
        $tit = substr($res, $p, $f - $p);
        $tit = trim(strtr($tit, array("\n" => "")));
        //url
        $p = strposF($res, "showMediaPreview(event, '", $p1);
        $f = strpos($res, "'", $p);
        $url = substr($res, $p, $f - $p);
        $r = array('url' => $url, 'titulo' => $tit, 'peso' => $tam);
        $resultados['enlaces'][] = $r;
    }
    dbug_r($resultados);
    return $resultados;
}
예제 #9
0
 function calcula()
 {
     //http://www.cope.es/player/id=2013072310430001&activo=6
     if (enString($this->web_descargada, "_url_xml_datos:")) {
         dbug("audio o video por xml");
         //_url_xml_datos:'/proyecto/fragmentosJSP/playerxml.jsp?id=2013072310430001,1,33,13,,1411',
         //http://www.cope.es/proyecto/fragmentosJSP/playerxml.jsp?id=2013072310430001,1,33,13,,1411
         $url = "http://www.cope.es" . entre1y2($this->web_descargada, "_url_xml_datos:'", "'");
         //http://www.cope.es/proyecto/fragmentosJSP/playerxml.jsp?id=2013072310430001,1,33,13,,1411
         $ret = CargaWebCurl($url);
         //mp3 y mp4: mp4->id=2013051613420001,1,30,,,1411
         $p = strposF($ret, 'type="content"');
         //$f=strposF($this->web_descargada,"'",$p);
         //http://www.cope.es/proyecto/fragmentosJSP/playerxml.jsp?id=2013072310430001,1,33,13,,1411
         $url = entre1y2_a($ret, $p, "<url>", "</url>");
         //http://vod.cope.es/audio/2013/07/23/audio_13745695177069462491.mp3
         //imagen
         $imagen = "http://www.cope.es/" . entre1y2($ret, "<img>", "</img>");
     } elseif (enString($this->web_descargada, "addCustomPlayer(")) {
         //addCustomPlayer('1iynycahpn4lw1ppzh0l6r5z1a', '15wugu5n3ruow1j9kwr3ma3tqz', '177dxsxbyqz8h18z4sldn5awz2', 686, 466, 'perf1iynycahpn4lw1ppzh0l6r5z1a-177dxsxbyqz8h18z4sldn5awz2', 'eplayer17', {age:1354724063000});
         //xml.eplayer.performgroup.com/eplayer/mrss/1iynycahpn4lw1ppzh0l6r5z1a/15wugu5n3ruow1j9kwr3ma3tqz//7-12
         //xml.eplayer.performgroup.com/eplayer/mrss/1iynycahpn4lw1ppzh0l6r5z1a/15wugu5n3ruow1j9kwr3ma3tqz
         preg_match("@addCustomPlayer\\('(.*?)',.*?'(.*?)'@", $this->web_descargada, $matches);
         $aCargar = 'http://xml.eplayer.performgroup.com/eplayer/mrss/' . $matches[1] . '/' . $matches[2];
         $xml = CargaWebCurl($aCargar);
         //dbug($xml);
         preg_match_all("@<item>[\\s\\S]*?</item>@", $xml, $matches);
         dbug_r($matches);
         foreach ($matches[0] as $item) {
             $urlTXT = entre1y2($item, '<title>', '</title>');
             $p = strrpos($item, 'url=');
             $url = entre1y2_a($item, $p, '"', '"');
             $obtenido['enlaces'][] = array('titulo' => $urlTXT, 'url' => $url, 'tipo' => 'rtmp');
         }
         $obtenido['titulo'] = 'Vídeos';
         $obtenido['imagen'] = 'http://www.' . DOMINIO . '/canales/cope.png';
         finalCadena($obtenido);
         return;
     } elseif (enString($this->web_descargada, '/proyecto/fragmentosJSP/playerxml.jsp')) {
         $ret = CargaWebCurl('http://www.cope.es' . desde1a2($this->web_descargada, '/proyecto/fragmentosJSP/playerxml.jsp', '"'));
         dbug_($ret);
         $url = entre1y2($ret, '<urlHtml>', '</');
         $obtenido = array('titulo' => 'Cope', 'imagen' => 'http://www.' . DOMINIO . '/canales/cope.png', 'enlaces' => array(array('url' => $url, 'url_txt' => 'Descargar', 'tipo' => 'http')));
         finalCadena($obtenido);
         return;
     } else {
         setErrorWebIntera('No se ha encontrado nada.');
         return;
     }
     //titulo
     $titulo = entre1y2($this->web_descargada, "<title>", "|");
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'http')));
     finalCadena($obtenido);
 }
예제 #10
0
 function calcula_urlAcortada()
 {
     foreach ($this->web_descargada_headers as $header) {
         if (strpos($header, 'Location: ') === 0) {
             $this->web = substr($header, strposF($header, 'Location: '));
             dbug('Location encontrado = ' . $this->web);
             $this->web_descargada = CargaWebCurl($this->web);
             $this->calcula();
             continue;
         }
     }
 }
예제 #11
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);
 }
예제 #12
0
 function resuelvePlayer($ret)
 {
     //return -> agregar a obtenido>enlaces
     if (enString($ret, "urlHTML5:'http://")) {
         $url = entre1y2($ret, "urlHTML5:'", "'");
     } else {
         $url = entre1y2($ret, "href:'", "'");
     }
     //titulo
     $p = strposF($ret, "<a");
     $titulo = utf8_encode(strip_tags(entre1y2_a($ret, $p, ">", "</a")));
     return array(array('titulo' => $titulo), array('url_txt' => "Descargar", 'url' => $url, 'tipo' => 'http'));
 }
예제 #13
0
function soundcloud()
{
    global $web;
    $client_id = "b45b1aa10f1ac2941910a7f0d10f8e28";
    $res = CargaWebCurl('https://api.sndcdn.com/search/sounds?facet=genre&limit=10&offset=0&linked_partitioning=1&client_id=' . $client_id . '&q=' . urlencode($web));
    $resultados = array('buscador' => 'soundcloud.com', 'enlaces' => array());
    $p1 = 0;
    for ($i = 0; $i < 10 && ($p1 = strpos($res, '"kind":"track"', $p1)); $i++) {
        //streamable?
        $p = strposF($res, '"streamable":', $p1);
        $f = strpos($res, ',', $p);
        $streamable = substr($res, $p, $f - $p);
        if ($streamable == "true") {
            //url
            $p = strposF($res, '"id":', $p1);
            $f = strpos($res, ",", $p);
            $modoUrl = "stream";
            $url = 'http://api.soundcloud.com/tracks/' . substr($res, $p, $f - $p) . '/' . $modoUrl . '?client_id=' . $client_id;
            //título
            $p = strposF($res, '"title":"', $p1);
            $f = strpos($res, '"', $p);
            $tit = utf8_encode(jsonRemoveUnicodeSequences(substr($res, $p, $f - $p)));
            //duración
            $p = strposF($res, '"duration":', $p1);
            $f = strpos($res, ',', $p);
            $duracion = (double) substr($res, $p, $f - $p) / 1000;
            $min = (int) ($duracion / 60);
            $seg = $duracion - $min * 60;
            $seg = substr($seg, 0, 2);
            while (enString($seg, ".")) {
                $seg = "0" . substr($seg, 0, 1);
            }
            $duracion = $min . ":" . $seg;
            //peso
            /*$p=strposF($res,'"original_content_size":',$p1);
            		$f=strpos($res,",",$p);
            		$tam=substr($res,$p,$f-$p);
            		$tam=((float)$tam)/1048576;
            		$tam=substr($tam,0,strpos($tam,".")+2);*/
            $r = array('url' => $url, 'titulo' => $tit, 'duracion' => $duracion, 'preview' => 1);
            $resultados['enlaces'][] = $r;
        }
        $p1++;
    }
    dbug_r($resultados);
    return $resultados;
}
예제 #14
0
 function calcula()
 {
     if (!enString($this->web_descargada, '<Form method="POST" action=\'\'>')) {
         setErrorWebIntera('No se encuentra ningún vídeo');
         return;
     }
     $id = substr($this->web, strposF($this->web, 'played.to/'));
     dbug('id = ' . $id);
     $web_embedPlayedTo = 'http://played.to/embed-' . $id . '-640x360.html';
     //
     $retfull = CargaWebCurl($web_embedPlayedTo, '', array('referer' => 'http://web.com'));
     $imagen = entre1y2($retfull, 'image: "', '"');
     $titulo = entre1y2($this->web_descargada, '<h1 class="pagename">', '<');
     // FALLA EN EL CALLBACK DEL SWF. EDITAR EL SWF
     $urlJS = 'function lanzaPlayedTo(){' . 'if(typeof DESCARGADOR_ARCHIVOS_SWF === "undefined"){' . 'setTimeout(lanzaPlayedTo, 200)' . '}' . 'else if(DESCARGADOR_ARCHIVOS_SWF === true){' . 'getFlashMovie("descargador_archivos").CargaWeb({' . '"url":"' . $web_embedPlayedTo . '",' . '"metodo":"GET"' . '}, "procesaPlayedTo2");' . '}' . '}' . 'function procesaPlayedTo2(txt){' . 'var url = txt.split("file: \\"")[1].split("\\"")[0];' . 'mostrarResultado(url);' . '}' . 'function mostrarResultado(entrada){' . 'finalizar(entrada,"Descargar");' . '}' . 'function mostrarFallo(){' . 'finalizar("","No se ha encontrado ningún resultado");' . '}' . 'if(typeof descargador_archivos === "undefined"){' . 'D.g("enlaces").innerHTML += \'' . genera_swf_object('/util/fla/f/http://played.to/') . '\';' . 'var descargador_archivos = D.g("descargador_archivos");' . '}' . 'lanzaPlayedTo();';
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $urlJS, 'tipo' => 'jsFlash')));
     finalCadena($obtenido);
 }
예제 #15
0
 function calcula()
 {
     $url = 'http://mmp.streamuk.com//api_v3/index.php?service=multirequest&action=null&kalsig=f5bf715cb3bf8c099fc8a26b3ffc8ecc';
     $post = "Referer: http://open.http.mmp.streamuk.com/p/2000092/sp/200009200/flash/kdp3/v3.9.3.3.1.31/kdp3.swf\r\n" . "Content-type: application/x-www-form-urlencoded\r\n" . "Content-length: 728\r\n" . urlencode("2:action=getContextData&" . "2:contextDataParams:objectType=KalturaEntryContextDataParams&" . "3:filter:objectType=KalturaCuePointFilter&" . "3:action=list&" . "ignoreNull=1&" . "2:contextDataParams:streamerType=rtmp&" . "2:contextDataParams:referrer={$this->web}&" . "2:entryId=0_ln0d3cfl&" . "1:entryId=0_ln0d3cfl&" . "apiVersion=3.1.5&" . "1:service=baseentry&" . "ks=" . base64_encode("d2e000426e5d32a45a4eb1f30e26a5a2238ee163|2000092;2000092;1413585766;0;1413499366.0907;0;view:*,widget:1;;") . "&" . "3:filter:entryIdEqual=0_ln0d3cfl&" . "1:action=get&" . "3:service=cuepoint_cuepoint&" . "2:service=baseentry&" . "1:version=-1&" . "clientTag=kdp:v3.9.3,cache_st:1405425098");
     $ret = CargaWebCurl($url, $post);
     if (enString($this->web_descargada, "mp4:")) {
         //http://www.intereconomia.com/sites/default/files/videos/rosa_paya.mp4
         $url = "http://www.intereconomia.com/sites/default/files/videos/" . entre1y2($this->web_descargada, 'mp4:', '.mp4') . '.mp4';
     } elseif (enString($this->web_descargada, "mp3:")) {
         $url = "http://www.intereconomia.com/sites/default/files/videos/" . entre1y2($this->web_descargada, 'mp3:', '.mp3') . '.mp3';
     }
     //titulo
     $titulo = entre1y2($this->web_descargada, "'Start','", "'");
     //imagen
     $p = strpos($this->web_descargada, '/sites/default/files/imagecache/');
     $f = strposF($this->web_descargada, '.', $p) + 3;
     //así se soporta .jpg y .gif
     $imagen = "http://www.intereconomia.com" . substr($this->web_descargada, $p, $f - $p);
     $obtenido = array('titulo' => $titulo, 'imagen' => $imagen, 'enlaces' => array(array('url' => $url, 'tipo' => 'http')));
     finalCadena($obtenido);
 }
예제 #16
0
function goear()
{
    global $web;
    $res = CargaWebCurl('http://www.goear.com/search/' . urlencode($web) . '/');
    //recortar a solo los enlaces
    $p = strposF($res, 'id="search_results"');
    $f = strpos($res, '</ol', $p);
    $res = substr($res, $p, $f - $p);
    $resultados = array('buscador' => 'goear.com', 'enlaces' => array());
    $p1 = 0;
    for ($i = 0; $i < 10 && ($p1 = strpos($res, '<li>', $p1)); $i++) {
        $p1++;
        //título
        $p = strpos($res, '<a', $p1);
        $p = strposF($res, '>', $p);
        $f = strpos($res, '</a', $p);
        $tit = substr($res, $p, $f - $p);
        $tit = strip_tags($tit);
        //url
        $p = strposF($res, "http://www.goear.com/listen/", $p1);
        $f = strpos($res, "/", $p + 1);
        $id = substr($res, $p, $f - $p);
        $url = buscaMP3($id);
        //bitrate
        $p = strpos($res, '<li class="kbps', $p1);
        $p = strposF($res, '>', $p);
        $f = strpos($res, "<", $p);
        $bitrate = substr($res, $p, $f - $p);
        //duración
        $p = strpos($res, '<li class="length', $p1);
        $p = strposF($res, '>', $p);
        $f = strpos($res, "</li", $p);
        $duracion = substr($res, $p, $f - $p);
        $duracion = trim($duracion);
        $r = array('url' => $url, 'titulo' => $tit, 'bitrate' => $bitrate, 'duracion' => $duracion, 'preview' => 1);
        $resultados['enlaces'][] = $r;
    }
    dbug_r($resultados);
    return $resultados;
}
예제 #17
0
 function parsefragment(&$arr, $html, $titulo, $multiple = false)
 {
     //rtmp://media1.crtvg.es:80/vod
     $p = strpos($html, 'clip:');
     if (!$p) {
         $p = strposF($html, '"clip":');
     }
     $p = strpos($html, 'url:', $p);
     if (!$p) {
         $p = strposF($html, '"provider":"rtmp","url":');
     }
     $url = entre1y2_a($html, $p, '"', '"');
     $url = str_replace('\\', '', $url);
     dbug('url=' . $url);
     //netConnectionUrl: "rtmp://media1.crtvg.es:80/vod"
     $p = strpos($html, 'netConnectionUrl:');
     if (!$p) {
         $p = strposF($html, '"netConnectionUrl":');
     }
     $preurl = entre1y2_a($html, $p, '"', '"');
     $preurl = str_replace('\\', '', $preurl);
     dbug('$preurl=' . $preurl);
     //ipadUrl: "http:// m3u8"
     $p = strpos($html, 'ipadUrl:');
     if (!$p) {
         $p = strposF($html, '"ipadUrl":');
     }
     $ipadUrl = entre1y2_a($html, $p, '"', '"');
     $ipadUrl = str_replace('\\', '', $ipadUrl);
     dbug('$ipadUrl=' . $ipadUrl);
     if ($multiple) {
         $arr[] = array('titulo' => $titulo);
     }
     $arr[] = array('url' => ' ', 'rtmpdump' => '-r "' . $preurl . '" -y "' . $url . '" -o "' . generaNombreWindowsValido($titulo) . '.mp4"', 'tipo' => 'rtmpConcreto');
     if (strlen($ipadUrl) > 10) {
         $arr[] = array('url' => $ipadUrl, 'tipo' => 'm3u8');
     }
 }
예제 #18
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);
 }
예제 #19
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);
     }
 }
예제 #20
0
 function calcula()
 {
     //soundcloud va a base de https, por lo que si alguna url http consigue llegar, toca pasarla a https
     $this->web = strtr($this->web, array("http://" => "https://"));
     $retfull = CargaWebCurl($this->web);
     $obtenido = array('enlaces' => array());
     //<img class="waveform" src="http://w1.sndcdn.com/9y15N1tRAubf_m.png" unselectable="on" />
     //detectar si hay varios enlaces o solo uno
     $canciones = substr_count($retfull, '<img class="waveform"');
     //dbug('total canciones='.$canciones);
     $imagen = 'http://www.' . DOMINIO . '/canales/soundcloud.png';
     //no sabemos cuantas queremos, pero es del modo nuevo y posiblemente varias.
     if (enString($retfull, "Next SoundCloud") || true) {
         dbug('Next SoundCloud');
         $client_id = 'b45b1aa10f1ac2941910a7f0d10f8e28';
         /*
         Lista de ids de clientes:
         Plug.dj => bd7fb07288b526f6f190bfd02b31b25e
         */
         $carga = CargaWebCurl('https://api.sndcdn.com/resolve?url=' . $this->web . '&_status_code_map[302]=200&_status_format=json&client_id=' . $client_id, '', 0, '', array(), false);
         dbug_($carga);
         if (enString($carga, 'tracks/')) {
             //una cancion
             dbug('Una canción');
             //Descargar la web para comprobar título y si tiene descarga gratis
             $carga = CargaWebCurl(entre1y2($carga, '"location":"', '"'));
             //comprobar si es stremeable. Si no lo es, fin del programa
             if (enString($carga, '<streamable type="boolean">false')) {
                 setErrorWebIntera('La descarga de esta canción está bloqueada.');
                 return;
             }
             preg_match('#tracks/([0-9]+)#', $carga, $match);
             $uri = $match[1];
             dbug($uri);
             $url = 'http://api.soundcloud.com/tracks/' . $uri . '/stream?client_id=' . $client_id;
             //titulo
             $titulo = entre1y2($this->web_descargada, '<title>', '</');
             if (enString($carga, "<artwork-url>")) {
                 $imagen = entre1y2($carga, '<artwork-url>', '</');
             }
             if (enString($carga, '<downloadable type="boolean">true') || enString($carga, '"downloadable":true')) {
                 $url = 'http://api.soundcloud.com/tracks/' . $uri . '/download?client_id=' . $client_id;
             }
             array_push($obtenido['enlaces'], array('url' => $url, 'tipo' => 'http', 'extension' => 'mp3'));
             dbug($titulo . ' - ' . $url);
         } else {
             //varias canciones
             dbug('Varias canciones');
             //titulo generico
             $titulo = "SoundCloud";
             //recortar web para sacar solo la id del user
             $f = strpos($this->web, '/', 8);
             $f2 = strpos($this->web, '/', $f + 1);
             if ($f2 > 0) {
                 $webMod = substr($this->web, 0, $f2);
             } else {
                 $webMod = $this->web;
             }
             //https://api.sndcdn.com/resolve?url=https%3A//soundcloud.com/forestrf&_status_code_map[302]=200&_status_format=json&client_id=b45b1aa10f1ac2941910a7f0d10f8e28
             $id = CargaWebCurl('https://api.sndcdn.com/resolve?url=' . $webMod . '&_status_code_map[200]=200&_status_format=json&client_id=' . $client_id);
             dbug('user info=' . $id);
             $p = strpos($id, '<id');
             $p = strposF($id, '>', $p);
             $f = strpos($id, '<', $p);
             $id = substr($id, $p, $f - $p);
             if (enString($id, '"')) {
                 $id = entre1y2($id, '"id":', ',');
             }
             dbug('id=' . $id);
             $stack = 500;
             $maxResTotal = 500;
             //likes
             //favorites
             //sounds
             //sets
             //playlists
             if (enString($this->web, 'sets') || enString($this->web, 'playlists')) {
                 $id = CargaWebCurl('https://api.soundcloud.com/resolve?url=' . $this->web . '&_status_code_map[200]=200&_status_format=json&client_id=' . $client_id, "", 0, "", array(), false);
                 $p = strposF($id, 'playlists/');
                 $f = strpos($id, '?', $p);
                 $id = substr($id, $p, $f - $p);
                 $tipoUrl = 2;
             } elseif (enString($this->web, 'likes') || enString($this->web, 'favorites')) {
                 $tipoUrl = 0;
             } else {
                 $tipoUrl = 1;
             }
             $mult = 0;
             $acabado = false;
             while (!$acabado && $stack * $mult <= $maxResTotal) {
                 $resResD = $stack * $mult;
                 if ($tipoUrl == 0) {
                     $carga = CargaWebCurl('http://api.soundcloud.com/users/' . $id . '/favorites.json?limit=' . $stack . '&offset=' . $resResD . '&client_id=' . $client_id);
                 } elseif ($tipoUrl == 1) {
                     $carga = CargaWebCurl('http://api.soundcloud.com/users/' . $id . '/tracks.json?limit=' . $stack . '&offset=' . $resResD . '&client_id=' . $client_id);
                 } elseif ($tipoUrl == 2) {
                     $carga = CargaWebCurl('http://api.soundcloud.com/playlists/' . $id . '.json?limit=' . $stack . '&offset=' . $resResD . '&client_id=' . $client_id);
                 }
                 if (enString($carga, '[{')) {
                     dbug('mult => ' . $mult);
                     $ronda = $ult = 0;
                     $carga = entre1y2($carga, '[{', '}]');
                     while (strpos($carga, 'kind":"track"', $ult) > 0 && $ronda < $stack) {
                         $ult = strpos($carga, 'kind":"track"', $ult);
                         if (entre1y2_a($carga, $ult, '"downloadable":', ',') == "true") {
                             $modoUrl = "download";
                         } else {
                             $modoUrl = "stream";
                         }
                         $tit = jsonRemoveUnicodeSequences(entre1y2_a($carga, $ult, '"title":"', '"'));
                         $p = strpos($carga, '"uri":"', $ult);
                         $p = strposF($carga, 'tracks/', $p);
                         $f = strpos($carga, '"', $p);
                         $f2 = strpos($carga, '/', $p);
                         if ($f > $f2) {
                             $f = $f2;
                         }
                         $url = 'http://api.soundcloud.com/tracks/' . substr($carga, $p, $f - $p) . '/' . $modoUrl . '?client_id=' . $client_id;
                         dbug($tit . ' - ' . $url);
                         //dbug($ult);
                         array_push($obtenido['enlaces'], array('url' => $url, 'tipo' => 'http', 'extension' => 'mp3', 'url_txt' => $tit));
                         $ronda++;
                         $ult++;
                     }
                     if ($ronda == $stack) {
                         $mult++;
                     } else {
                         $acabado = true;
                     }
                 } else {
                     $acabado = true;
                 }
             }
         }
     }
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido, false);
 }
예제 #21
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);
 }
예제 #22
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;
 }
예제 #23
0
 function calcula()
 {
     $obtenido = array('enlaces' => array());
     /*
     http://www.ccma.cat/324/Grecia-haura-de-celebrar-eleccions-despres-de-fracassar-el-tercer-intent-delegir-president/noticia/2625031/
     http://www.tv3.cat/videos/188877281/Els-ajudants-del-pare-Noel#
     videos/188877281/
     http://www.tv3.cat/pvideo/FLV_bbd_dadesItem.jsp?idint=
     */
     if (enString($this->web, 'http://www.tv3.cat/pprogrames/hd/mhdSeccio.jsp')) {
         setErrorWebIntera('Los vídeos en HD pueden descargarse desde TV3.');
         return;
     }
     $id = '';
     if (enString($this->web_descargada, 'arrayVideos = [')) {
         $id = entre1y2($this->web_descargada, 'arrayVideos = [', ',');
         dbug('video de formato admitido en js. id video=' . $id);
     } elseif (enString($this->web_descargada, '.videoid')) {
         preg_match('@\\.videoid[^0-9^;]+([0-9]+?);@', $this->web_descargada, $match);
         dbug_r($match);
         $id = $match[1];
         dbug('video de formato admitido en js (.videoid). id video=' . $id);
     } elseif (enString($this->web_descargada, 'idint="')) {
         $id = entre1y2($this->web_descargada, 'dint="', '"');
         dbug('video de formato admitido en js (dint="). id video=' . $id);
     } elseif (enString($this->web_descargada, '<div class="SSG cat_videos">')) {
         preg_match_all('#<h2>(.+?)</h2>[\\s\\S]*?<span class="id_video">([0-9]+?)</span>#', $this->web_descargada, $matches);
         dbug_r($matches);
         for ($i = 0, $ii = count($matches[0]); $i < $ii; $i++) {
             $obtenido['enlaces'][] = array('titulo' => utf8_encode($matches[1][$i]));
             $this->resuelveIDMetodo2($matches[2][$i], $obtenido['enlaces'], $titulo, $imagen, true);
         }
         dbug('Varios vídeos (<div class="SSG cat_videos">)');
         $obtenido['titulo'] = $titulo;
         $obtenido['imagen'] = $imagen;
         finalCadena($obtenido);
         return;
     } else {
         //la id esta en la url
         $p = strrposF($this->web, '/videos/');
         $f = strrpos($this->web, '/', $p);
         if (!$f) {
             $id = substr($this->web, $p);
         } else {
             $id = substr($this->web, $p, $f - $p);
         }
         if (stringContains($id, array(' ', '<', '>', '/', '.')) || $id == '') {
             //la id esta en la url, o deberia, pero no esta como siempre. encontrar.
             // '/\/[0-9^\/]*\//';
             preg_match_all('|/([0-9]+)/|', str_replace('//www.ccma.cat/324/', '', $this->web), $coincidencias, PREG_OFFSET_CAPTURE);
             dbug_r($coincidencias);
             $id = $coincidencias[1][0][0];
         }
         dbug('video de formato admitido? (en url): id video=' . $id);
     }
     $tresalacarta = 0;
     if (stringContains($id, array(' ', '<', '>', '/', '.')) || $id == '') {
         //3alacarta
         if (enString($this->web, '3alacarta')) {
             dbug('3alacarta');
             $p = strpos($this->web, '/#/') + 2;
             $id = substr($this->web, $p);
             $tresalacarta = 1;
         }
     }
     if (stringContains($id, array('<', '>', '/', '.')) || $id == '') {
         $p = strpos($this->web_descargada, '<object');
         $id = entre1y2_a($this->web_descargada, $p, "id='EVP", "'");
         $letras = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
         $id = str_replace($letras, '', strtoupper($id));
     }
     if (!is_numeric($id) || $id == '') {
         $retfull_no_espacios = str_replace(' ', '', $this->web_descargada);
         //la id esta en el html
         //VIDEO_ID = 4018251;
         $p = strrposF($retfull_no_espacios, 'VIDEO_ID=');
         $f = strpos($retfull_no_espacios, ';', $p);
         $id = substr($retfull_no_espacios, $p, $f - $p);
         if (!is_numeric($id) || $id == '') {
             //la id esta en el html
             //VIDEO_ID = 4018251;
             $p = strrposF($retfull_no_espacios, 'videoid=');
             $f = strpos($retfull_no_espacios, '&', $p);
             $id = substr($retfull_no_espacios, $p, $f - $p);
             if (!is_numeric($id) || $id == '') {
                 $p = strrposF($retfull_no_espacios, 'videoid=');
                 $f = strpos($retfull_no_espacios, ';', $p);
                 $id = substr($retfull_no_espacios, $p, $f - $p);
                 //echo '.'.$retfull_no_espacios.'.';
                 if (!is_numeric($id) || $id == '') {
                     //<span class="id_video">3260890</span>
                     $id = entre1y2($retfull_no_espacios, '<spanclass="id_video">', '</span>');
                     if (!is_numeric($id) || $id == '') {
                         //<span> </span>
                         $sujeto = $retfull_no_espacios;
                         //$patron = '/\/[0-9^\/]*\//';
                         $patron = '|<span>([0-9]+)</span>|';
                         preg_match_all($patron, $sujeto, $coincidencias, PREG_OFFSET_CAPTURE);
                         dbug_r($coincidencias);
                         $id = $coincidencias[1][0][0];
                         if (!is_numeric($id) || $id == '') {
                             //<span class="id">3260890</span>
                             $id = entre1y2($retfull_no_espacios, '<spanclass="id">', '</span>');
                             if (!is_numeric($id) || $id == '') {
                                 //embedEVPLight(2692490,601)
                                 $id = entre1y2($retfull_no_espacios, 'embedEVPLight(', ',');
                                 if (!is_numeric($id) || $id == '') {
                                     dbug('fallo');
                                 }
                             } else {
                                 dbug('span class="id"');
                             }
                         } else {
                             dbug('span');
                         }
                     } else {
                         dbug('span class="id_video"');
                     }
                 } else {
                     dbug('encontrado con videoid = ');
                 }
             } else {
                 dbug('encontrado con VIDEO_ID = ');
             }
         } else {
             dbug('encontrado con VIDEOID=...&');
         }
         dbug('video de formato admitido (en html): id video=' . $id);
     } else {
         dbug('id sacada con <object ... id="EVP..." -> id video=' . $id);
     }
     if ($id == '') {
         //id no encontrada:
         //fallo url
         setErrorWebIntera('No se pudo encontrar la ID de ningún vídeo.');
         return;
     }
     /////////usa de estas dos dice que es un video de windows media player...
     //playWMOVideoQualitat
     //video-wmp
     if (enString($this->web_descargada, 'playWMOVideoQualitat')) {
         dbug('metodo 1');
         if ($tresalacarta != 1) {
             //titulo
             //<h1>Els ajudants del pare Noel</h1>
             $titulo = entre1y2($this->web_descargada, '<h1>', '</h1>');
             $titulo = limpiaTitulo($titulo);
             dbug('titulo=' . $titulo);
         }
         $this->resuelveIDMetodo1($id, $obtenido['enlaces']);
     } else {
         if (enString($this->web_descargada, 'insertaEVP(')) {
             dbug('metodo 2');
             if ($tresalacarta != 1) {
                 //titulo
                 //<h1>Amb Fidel, passi el que passi</h1>
                 $titulo = entre1y2($this->web_descargada, '<h1>', '</h1>');
                 if (stringContains($titulo, array('<', '>'))) {
                     $titulo = entre1y2($titulo, 'arrayTitol = ["', '"');
                 } else {
                     //imagen
                     //'/multimedia/jpg/3/6/1336300867363.jpg'
                     $p = strpos($this->web_descargada, "/multimedia/");
                     $f = strposF($this->web_descargada, '.jpg', $p);
                     $imagen = 'http://www.tv3.cat' . substr($this->web_descargada, $p, $f - $p);
                     dbug('imagen=' . $imagen);
                 }
                 $titulo = limpiaTitulo($titulo);
                 dbug('titulo=' . $titulo);
             }
             //insertaEVP("flashcontent", flashvars, params, size );
             $this->resuelveIDMetodo2($id, $obtenido['enlaces'], $titulo, $imagen);
         } elseif ($id !== '') {
             dbug('metodo (3). Suponemos que hay id.');
             $this->resuelveIDMetodo2($id, $obtenido['enlaces'], $titulo, $imagen);
         }
     }
     $obtenido['titulo'] = $titulo;
     $obtenido['imagen'] = $imagen;
     finalCadena($obtenido);
 }
예제 #24
0
function entre1y2_a(&$que, $desfaseInicio = 0, $start, $fin = null)
{
    if (is_int($start)) {
        $p = $start;
    } else {
        $p = strposF($que, $start, is_int($desfaseInicio) ? $desfaseInicio : strposF($que, $desfaseInicio));
    }
    if ($fin === null) {
        return substr($que, $p);
    }
    if (is_int($fin)) {
        $f = $fin;
    } else {
        $f = strpos($que, $fin, $p);
    }
    return substr($que, $p, $f - $p);
}
예제 #25
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);
 }
예제 #26
0
 function agregaSubDominio($a)
 {
     $p = strposF($this->web, 'http://');
     $f = strpos($this->web, ".rt.com", $p);
     if ($f < 0) {
         return 'http://' . substr($this->web, $p, $f - $p) . '.rt.com' . $a;
     } else {
         return 'http://rt.com' . $a;
     }
 }
예제 #27
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);
 }
예제 #28
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);
 }
예제 #29
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);
 }