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); }
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; }
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); }
function calcula() { $obtenido = array('enlaces' => array()); $pageId = substr($this->web, strrposF($this->web, '/')); dbug_($pageId); if (preg_match('#"pageId":"' . $pageId . '".+?"urls":\\[(.+?)[,\\]]#', $this->web_descargada, $matches)) { $jsonurl = $matches[1]; } else { setErrorWebIntera('No se ha encontrado ningún vídeo.'); return; } dbug_($jsonurl); $jsonurl = json_decode($jsonurl, true); dbug_($jsonurl); $json = CargaWebCurl($jsonurl); dbug_($json); $json2 = json_decode($json, true); $titulo = $json2['title']; // http://www.arucitys.com.usrfiles.com/html/5eb649_d2c495cc1c5e09ffcb959aa180074c3d.html $html = desde1a2($json, '"html/', '"', true); $html = json_decode($html, true); $html = 'http://www.arucitys.com.usrfiles.com/' . $html; dbug_($html); $html = CargaWebCurl($html); dbug_($html); $app_flash = trim(entre1y2($html, 'app_flash=', '&')); dbug_($app_flash); $ubicacion_fichero = trim(entre1y2($html, 'ubicacion_fichero=', '&')); dbug_($ubicacion_fichero); $rtmpbase = 'rtmp://178.33.166.26/' . $app_flash; $rtmp = $rtmpbase . '/mp4:' . $ubicacion_fichero; $obtenido['enlaces'] = array(array('url' => $rtmp, 'rtmpdump' => '-r "' . $rtmpbase . '" -y "' . $ubicacion_fichero . '" -o "' . generaNombreWindowsValido($titulo) . '.mp4"', 'url_txt' => 'Descargar', 'tipo' => 'rtmpConcreto')); $obtenido['titulo'] = $titulo; $obtenido['imagen'] = $imagen; finalCadena($obtenido, false); }
function calcula() { //dbug_($this->web_descargada); $obtenido = array('enlaces' => array()); if (!enString($this->web_descargada, 'catalog.video.msn.com/image.aspx')) { dbug('modo nuevo'); // No soportado // http://m.telemundo.com/video.php?show=elsenordeloscieloscapitulosecreto&id=najcVXTKRqnrWKiVUmcE&key=video // http://m.telemundo.com/video.php?show=lavozkids&id=oWvtdFNRlmwOemyqHpCF&key=video //setErrorWebIntera('No se encuentra ningún vídeo o no está soportado'); // http://now.telemundo.com/caso-cerrado/full-episodes/abuso-polic%C3%ADaco/322424899858 // http://player.theplatform.com/p/HNK2IC/telemundo_vod_noauth/embed/select/uLCEWFk911nP?autoPlay=true&mbr=true&FWsiteSection=tm_tveverywhere_vod_hub#playerurl=http%3A//now.telemundo.com/caso-cerrado/full-episodes/abuso-polic%25C3%25ADaco/322424899858 // https://player.theplatform.com/p/HNK2IC/telemundo_vod_noauth/embed/select/uLCEWFk911nP?autoPlay=false // https://link.theplatform.com/s/HNK2IC/uLCEWFk911nP?mbr=true&policy=2713557&player=Telemundo VOD No Auth Player (pub7)&manifest=f4m&format=SMIL&Tracking=true&Embedded=true&formats=F4M,MPEG4 // No va // https://link.theplatform.com/s/HNK2IC/uLCEWFk911nP?mbr=true&policy=2713557&player=Telemundo VOD No Auth Player (pub7) // Parece que se puede arreglar así: /* http://www.telemundo.com/shows/2014/11/20/maestros-armados-por-defensa-y-gemelas-con-el-mismo-marido-caso-cerrado-video "clip_image":"http:\/\/www.telemundo.com\/sites\/nbcutelemundo\/files\/images\/mpx\/2014\/11\/21\/141120_2829830_Maestros_armados_por_defensa_y_gemelas_con_e_0.jpg" "clip_title":"Maestros armados por defensa y gemelas con el mismo marido. Caso Cerrado (VIDEO)" "clip_descr":"Marlene es profesora, y quiere ir a dar clase con una pistola para poder defenderse en caso de una asesino en serie. Y, Karla y Tania tienen el mismo marido y reclaman la herencia que les dej\u00f3 su padre.\u00a0" iframe //player.theplatform.com/p/0L7ZPC/ztJiSNFd5ggr/embed/select/iWUW_xbJZGrj?siteSectionId=telemundo_video_hub_vod&autoPlay=true //theplatform.com/p/0L7ZPC/ztJiSNFd5ggr/embed/select/iWUW_xbJZGrj?siteSectionId=telemundo_shows_vod&autoPlay=true http://proxymexico.com http://link.theplatform.com/s/0L7ZPC/iWUW_xbJZGrj?mbr=true&player=P7%20VOD%20Player&policy=40180 http://link.theplatform.com/s/0L7ZPC/EuIyUv4n0nlm?mbr=true&player=P7%20VOD%20Player&policy=40180&switch=progressive&formats=mpeg4&format=SMIL&embedded=true&tracking=true */ if (enString($this->web, '//now.')) { // now.telemundo.com $desde = 1; // "episode_thumbnail":{"url":"http:\/\/tve_static-telemundo.nbcuni.com\/prod\/image\/478\/1007\/141117_2828781_Andrea_del_Junco_anvver_1_560x315_362507843555.jpg" // "synopsis":"Scarlet Gruber es Andrea del Junco, una joven seria, reservada y competente que anhela ser como su madre." $p = strpos($this->web_descargada, '//player.'); $imagen = entre1y2_a($this->web_descargada, $p, 'src="', '"'); dbug_($imagen); $titulo = entre1y2($this->web_descargada, '<meta property="og:title" content="', '"'); $player = 'http:' . desde1a2($this->web_descargada, $p, '"'); dbug_($player); } else { $desde = 2; $imagen = entre1y2($this->web_descargada, '"clip_image":"', '"'); $imagen = json_decode('"' . $imagen . '"'); dbug_($imagen); $titulo = entre1y2($this->web_descargada, '"clip_title":"', '"'); $titulo = json_decode('"' . $titulo . '"'); dbug_($titulo); // buscar si es una parte. if (enString($this->web_descargada, '<li class="player--nav-item-active">')) { $titulo .= ', parte ' . trim(strip_tags(entre1y2($this->web_descargada, '<li class="player--nav-item-active">', '</li'))); } $descripcion = entre1y2($this->web_descargada, '"clip_descr":"', '"'); $descripcion = json_decode('"' . $descripcion . '"'); dbug_($descripcion); $iframe = entre1y2($this->web_descargada, '<iframe', '<'); dbug_($iframe); $player = 'http://' . desde1a2($iframe, 'player.', '"'); dbug_($player); $obtenido['descripcion'] = $descripcion; } $obtenido['titulo'] = $titulo; $obtenido['imagen'] = $imagen; $ret = CargaWebCurl($player); $releaseUrl = entre1y2($ret, 'releaseUrl="', '"'); dbug_($releaseUrl); $releaseUrl .= '&switch=progressive&formats=mpeg4&format=SMIL&embedded=true&tracking=true'; dbug_($releaseUrl); $ret = CargaWebCurlProxy($releaseUrl, 'MX'); dbug_($ret); if (preg_match_all('@"(https?://[^"]+\\.(?:mp4|flv).+?)".+?bitrate="(.+?)"@i', $ret, $matches)) { dbug_r($matches); $links = array_unique($matches[1]); $calidades = array_unique($matches[2]); dbug_r($links); for ($i = 0, $i_t = count($links); $i < $i_t; $i++) { $obtenido['enlaces'][] = array('url' => $desde === 1 ? $this->quitar_akami_telemundo($links[$i]) : $links[$i], 'url_txt' => 'Descargar en calidad ' . intval($calidades[$i] / 1024), 'tipo' => 'http'); } } else { dbug('Adivinar urls a partir de la imagen'); dbug_($imagen); $posibles_calidades = array('4000', '2500', '1800', '1696', '1296', '1200', '896', '700', '696', '496', '400', '306', '240', '200'); if (preg_match('#anvver#', $imagen, $matches) || preg_match('#[0-9]+x[0-9]+#', $imagen, $matches)) { dbug_r($matches); $supuesta_url_base = entre1y2($imagen, 0, $matches[0]); $supuesta_url_base = str_replace('/image/', '/video/', $supuesta_url_base); for ($i = 0, $i_t = count($posibles_calidades); $i < $i_t; $i++) { $obtenido['enlaces'][] = array('url' => $supuesta_url_base . $posibles_calidades[$i] . '.mp4', 'url_txt' => 'Descargar en calidad ' . $posibles_calidades[$i], 'tipo' => 'http'); } $obtenido['alerta_especifica'] = 'No se ha podido encontrar ningún enlace para el vídeo pero alguno de los siguientes podría funcionar.'; } } } else { dbug('modo antiguo'); $imagen = 'http://img3.catalog.video.msn.com/image.aspx' . entre1y2($this->web_descargada, 'catalog.video.msn.com/image.aspx', '"'); dbug_($imagen); $uuid = entre1y2($imagen, 'uuid=', '&'); dbug_($uuid); $imagen = 'http://img3.catalog.video.msn.com/image.aspx?uuid=' . $uuid . '&w=500&h=250&so=4'; dbug_($imagen); $url = "http://hub.video.msn.com/services/videodata/?callback=JsonpCb0&ids={$uuid}&detailed=true&responseEncoding=json&v=2"; $ret = CargaWebCurl($url); $ret = substr($ret, 9, -1); $ret = str_replace("'", '"', $ret); $ret = preg_replace('/(\\w+):/i', '"\\1":', $ret); $ret = preg_replace_callback('/\\\\x.{2}/i', function ($a) { return chr('0' . substr($a[0], 1)); }, $ret); dbug_($ret); $ret = json_decode($ret, true); dbug(json_last_error()); dbug_r($ret); $titulo = $ret['videos'][0]['title']; $calidades = array('105' => '1080p', '104' => '720p', '103' => '480p', '102' => '360p', '101' => '240p', '1005' => '1080p', '1004' => '720p', '1003' => '480p', '1002' => '360p', '1001' => '240p'); foreach ($ret['videos'][0]['files'] as &$elem) { $ret['videos'][0]['files'][$elem['formatCode']] =& $elem; } foreach ($calidades as $i => $calidad) { if (isset($ret['videos'][0]['files'][$i])) { $elem =& $ret['videos'][0]['files'][$i]; if (!stringContains($elem['url'], array('.mp4', '.flv'))) { continue; } foreach ($obtenido['enlaces'] as &$enl) { if (substr($enl['url'], 20) === substr($elem['url'], 20)) { continue 2; } } $obtenido['enlaces'][] = array('url' => $elem['url'], 'url_txt' => 'Descargar en ' . $calidad, 'tipo' => 'http'); } } $obtenido['titulo'] = $titulo; $obtenido['imagen'] = $imagen; } finalCadena($obtenido, false); }
function calcula() { $obtenido = array('enlaces' => array()); /* http://www.nbcuniverso.com/shows/a-toda-gloria/toda-gloria-extended-scene-gloria-llega-peru-episode-13 http://mun2-static.nbcuni.com/MPX/image/NBCU_mun2/978/1019/141224_2836917_A_Toda_Gloria_extended_scene__Gloria_llega_a.jpg http://mun2-pmd.edgesuite.net/MPX/video/NBCU_mun2/978/1019/141224_2836917_A_Toda_Gloria_extended_scene__Gloria_llega_a_4000.mp4 http://mun2-pmd.edgesuite.net/MPX/video/NBCU_mun2/978/1019/141224_2836917_A_Toda_Gloria_extended_scene__Gloria_llega_a_2500.mp4 */ $titulo = entre1y2($this->web_descargada, '<meta property="og:title" content="', '"'); $obtenido['descripcion'] = entre1y2($this->web_descargada, '<meta name="description" content="', '"'); if (enString($this->web, '/now/')) { dbug('now'); // now.telemundo.com $desde = 1; $player = 'http:' . desde1a2($this->web_descargada, '//player.theplatform.com/p/', '"'); dbug_($player); } else { dbug('no now'); $desde = 2; //$imagen = entre1y2($this->web_descargada, '<meta property="og:image" content="', '"'); if (enString($this->web_descargada, '<li class="player--nav-item-active">')) { $titulo .= ', parte ' . trim(strip_tags(entre1y2($this->web_descargada, '<li class="player--nav-item-active">', '</li'))); } $player = desde1a2($this->web_descargada, 'http://player.theplatform.com', '"'); dbug_($player); $player = str_replace('/swf/', '/embed/', $player); dbug_($player); } $obtenido['titulo'] = $titulo; $ret = CargaWebCurl($player); $imagen = entre1y2($ret, '<meta property="og:image" content="', '"'); dbug_($imagen); $obtenido['imagen'] = $imagen; if (enString($this->web, '/now/')) { $obtenido['alerta_especifica'] = 'No se ha podido encontrar ningún enlace para el vídeo pero alguno de los siguientes podría funcionar.'; $urlNuevo = preg_replace('#http://.*?/image/#', 'https://tvenbcuniverso-vh.akamaihd.net/i/prod/video/', $imagen); $urlViejo = preg_replace('#http://.*?/image/#', 'https://tvenbcuniverso-vh.akamaihd.net/i/prod/video/', $imagen); $nuevoAgregado = false; if (preg_match('#anvver_([0-9])_#', $urlNuevo, $matches)) { dbug_r($matches); $urlNuevo = desde1a2($urlNuevo, 0, $matches[0]) . 'anvver_' . ($matches[1] - 1) . '_,40,25,18,12,7,4,2,00.mp4.csmil/master.m3u8'; dbug_($urlNuevo); $obtenido['enlaces'][] = array('titulo' => 'Calidades nuevas', 'url' => $urlNuevo, 'tipo' => 'm3u8'); $nuevoAgregado = true; } if (preg_match('#anvver#', $urlViejo, $matches) || preg_match('#[0-9]+x[0-9]+#', $urlViejo, $matches)) { dbug_r($matches); $urlViejo = entre1y2($urlViejo, 0, $matches[0]) . ',1696,1296,896,696,496,240,306,.mp4.csmil/master.m3u8'; dbug_($urlViejo); $obtenido['enlaces'][] = array('titulo' => 'Calidades antiguas', 'url' => $urlViejo, 'tipo' => 'm3u8'); if (!$nuevoAgregado) { $urlNuevo = entre1y2($urlNuevo, 0, $matches[0]) . ',40,25,18,12,7,4,2,00.mp4.csmil/master.m3u8'; dbug_($urlNuevo); $obtenido['enlaces'][] = array('titulo' => 'Calidades nuevas', 'url' => $urlNuevo, 'tipo' => 'm3u8'); } } finalCadena($obtenido, false); return; } $releaseUrl = entre1y2($ret, 'releaseUrl="', '"'); dbug_($releaseUrl); $releaseUrl .= '&switch=progressive&formats=mpeg4&format=SMIL&embedded=true&tracking=true'; dbug_($releaseUrl); $ret = CargaWebCurlProxy($releaseUrl, 'MX'); dbug_($ret); if (preg_match_all('@"(https?://[^"]+\\.(?:mp4|flv).+?)".+?bitrate="(.+?)"@i', $ret, $matches)) { dbug_r($matches); $links = array_unique($matches[1]); $calidades = array_unique($matches[2]); dbug_r($links); for ($i = 0, $i_t = count($links); $i < $i_t; $i++) { $obtenido['enlaces'][] = array('url' => $desde === 1 ? $this->quitar_akami_telemundo($links[$i]) : $links[$i], 'url_txt' => 'Descargar en calidad ' . intval($calidades[$i] / 1024), 'tipo' => 'http'); } } else { dbug('Adivinar urls a partir de la imagen'); $posibles_calidades = array('4000', '2500', '1800', '1696', '1296', '1200', '896', '700', '696', '496', '400', '306', '240', '200'); $supuesta_url_base = entre1y2($imagen, 0, 'anvver'); $supuesta_url_base = str_replace('/image/', '/video/', $supuesta_url_base); for ($i = 0, $i_t = count($posibles_calidades); $i < $i_t; $i++) { $obtenido['enlaces'][] = array('url' => $supuesta_url_base . $posibles_calidades[$i] . '.mp4', 'url_txt' => 'Descargar en calidad ' . $posibles_calidades[$i], 'tipo' => 'http'); } $obtenido['alerta_especifica'] = 'No se ha podido encontrar ningún enlace para el vídeo pero alguno de los siguientes podría funcionar.'; } finalCadena($obtenido, false); }