diff options
author | Jesús <heckyel@hyperbola.info> | 2020-12-06 17:10:40 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-12-06 17:10:40 -0500 |
commit | 6a3a940d7344a81081294d9ad3a33b75af303ced (patch) | |
tree | f8eb6c190123e6fb24614deb6cfd80909ae465f9 | |
parent | 8103275cffa5aeb2a38a46b6121545f622178c41 (diff) | |
download | ytlibre-6a3a940d7344a81081294d9ad3a33b75af303ced.tar.lz ytlibre-6a3a940d7344a81081294d9ad3a33b75af303ced.tar.xz ytlibre-6a3a940d7344a81081294d9ad3a33b75af303ced.zip |
Make core extract
-rw-r--r-- | embed/index.php | 17 | ||||
-rw-r--r-- | index.php | 23 | ||||
-rw-r--r-- | templates/css/salida.min.css | 3 | ||||
-rw-r--r-- | templates/embed.tpl | 67 | ||||
-rw-r--r-- | templates/sass/salida.sass | 23 | ||||
-rw-r--r-- | templates/video.tpl | 121 | ||||
-rw-r--r-- | tools/extract.php | 518 | ||||
-rw-r--r-- | tools/processor.php | 114 | ||||
-rw-r--r-- | tools/sig.php | 1 |
9 files changed, 654 insertions, 233 deletions
diff --git a/embed/index.php b/embed/index.php index 538f50b..ca2f36c 100644 --- a/embed/index.php +++ b/embed/index.php @@ -1,5 +1,9 @@ <?php require_once('../smarty/Smarty.class.php'); + +define('ROOT_PATH', preg_replace('/index.php/', '', $_SERVER["DOCUMENT_ROOT"].$_SERVER["DOCUMENT_URI"])); +define('TOOLS_PATH', preg_replace('|\/embed|', '', ROOT_PATH.'tools/') ); + $titulo="YTLibre"; $template= new Smarty(); @@ -16,24 +20,19 @@ if (empty($_GET['link'])){ $template->display('../templates/index.tpl'); } else { /* ---- ---- video-generated ---- ---- */ - require_once "../tools/processor.php"; + require_once ( TOOLS_PATH.'processor.php' ); $video_decode = new Smarty(); /* ---- ---- Variables ---- ---- */ $video_decode->assign("titulo", $titulo); $video_decode->assign("videoTitle", $videoTitle); - $video_decode->assign("librethumb", $librethumb); + $video_decode->assign("videoThumbURL", $videoThumbURL); // Videos Loop $video_decode->assign("streamFormats", $streamFormats); - // URL DRM - $video_decode->assign("breakurl", $breakurl); - - // Video DRM - $video_decode->assign("breaklink", $breaklink); - $video_decode->assign("breakquality", $breakquality); - $video_decode->assign("formatdrm", $formatdrm); + // Live + $video_decode->assign("islive", $islive); /* ---- ---- CSS ---- ---- */ $video_decode->assign('styles', array('frond' => '../templates/css/frond.min.css', @@ -1,6 +1,9 @@ <?php require_once('smarty/Smarty.class.php'); +define('ROOT_PATH', preg_replace('/index.php/', '', $_SERVER["DOCUMENT_ROOT"].$_SERVER["DOCUMENT_URI"])); +define('TOOLS_PATH', ROOT_PATH.'tools/'); + $titulo="YTLibre"; $version="1.1.5"; /* ---- ---- ---- Generated ---- ---- ---- ---- */ @@ -28,34 +31,18 @@ else $video_decode->assign("videoTitle", $videoTitle); $video_decode->assign("videoThumbURL", $videoThumbURL); $video_decode->assign("videoAuthor", $videoAuthor); - $video_decode->assign("videoChannel", $videoChannel); $video_decode->assign("videoDuration", $videoDuration); $video_decode->assign("videoViews", $videoViews); - $video_decode->assign("librethumb", $librethumb); - - // Downloads - $video_decode->assign("downloads", $downloads); // Videos Loop $video_decode->assign("streamFormats", $streamFormats); - // URL DRM - $video_decode->assign("breakurl", $breakurl); + // Live $video_decode->assign("islive", $islive); - // Download DRM - $video_decode->assign("downloadbreak", $downloadbreak); - $video_decode->assign("downloadQuality", $downloadQuality); - $video_decode->assign("downloadFormat", $downloadFormat); - - // Video DRM - $video_decode->assign("breaklink", $breaklink); - $video_decode->assign("breakquality", $breakquality); - $video_decode->assign("formatdrm", $formatdrm); - // URL's $video_decode->assign("local_url", $local_url); - $video_decode->assign("url_freedom", $url_freedom); + $video_decode->assign("url_query", $url_query); /* ---- ---- CSS ---- ---- */ $video_decode->assign('styles', array('frond' => 'templates/css/frond.min.css', diff --git a/templates/css/salida.min.css b/templates/css/salida.min.css index 0100963..193ce55 100644 --- a/templates/css/salida.min.css +++ b/templates/css/salida.min.css @@ -1 +1,2 @@ -body{background:#2d3743;color:#fff}a.enlace{color:#1aafff;text-decoration:none}a.enlace:hover{color:#2dde98}.contenedor{margin:auto;width:100%;max-width:800px;display:flex;flex-direction:column;flex-wrap:wrap;align-items:center}.contenedor .libreyt{padding-bottom:20px}.contenedor .libreyt .row{display:flex;width:80%;max-width:400px;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:center}.contenedor .libreyt .row .imageyt{flex:1 0 30%;max-width:40%;padding:0px 15px}.contenedor .libreyt .row .imageyt img{width:100%;vertical-align:middle}.contenedor .libreyt .row .features{flex:0;min-height:1px;max-height:100%;position:relative;padding:0px 15px}.contenedor .libreyt .row .features .yt-titulo{font-weight:700;font-size:1rem;line-height:24px}.contenedor .row{line-height:2.5}.contenedor .row .col{text-align:center;padding:0px 15px}.contenedor .row .col .boton-descarga{padding:2px 5px;font-size:12px;border-radius:3px;color:#fff;background-color:#5cb85c;border-color:#5cb85c;text-decoration:none}.librevideojs{width:90%;max-width:700px}.mpv{margin-bottom:.5rem;margin-top:0}header{display:flex;width:90%;padding:20px 0px;justify-content:center}header a.drm-free{align-items:center;height:auto;opacity:.5;transition:opacity 150ms}header a.drm-free:before{content:url("../images/drm-free.png");vertical-align:top;display:block;position:absolute;top:12px;left:12px;max-width:120px;width:100%}header a.drm-free:hover{opacity:1}h2,h3,h4,h5,h6{margin-top:0;margin-bottom:0;line-height:1.1}hr{width:100%}section{width:100%}h2{text-align:center}footer p.copyleft{font-size:12px;text-align:center}@media screen and (max-width: 768px){header a.drm-free:before{display:none}} +body{background:#2d3743;color:#fff}a.enlace{color:#1aafff;text-decoration:none}a.enlace:hover{color:#2dde98}.contenedor{margin:auto;width:100%;max-width:800px;display:grid;grid-template-columns:auto;grid-template-rows:auto auto;grid-gap:1rem}.contenedor .libreyt .row{display:flex;width:80%;max-width:400px;flex-direction:row;flex-wrap:wrap;align-items:center;justify-self:center;justify-content:center}.contenedor .libreyt .row .imageyt{flex:1 0 30%;max-width:40%;padding:0px 15px}.contenedor .libreyt .row .imageyt img{width:100%;vertical-align:middle}.contenedor .libreyt .row .features{flex:0;min-height:1px;max-height:100%;position:relative;padding:0px 15px}.contenedor .libreyt .row .features .yt-titulo{font-weight:700;font-size:1rem;line-height:24px}.contenedor .row{line-height:2.5}.contenedor .row .col{text-align:center;padding:0px 15px}.contenedor .row .col .boton-descarga{padding:2px 5px;font-size:12px;border-radius:3px;color:#fff;background-color:#5cb85c;border-color:#5cb85c;text-decoration:none}.contenedor .v-download ul.download-dropdown-content{padding-top:1rem;padding-bottom:1rem;background:#000;border:solid 1px #00b7f1}.contenedor .v-download ul.download-dropdown-content li a{text-decoration:none}.contenedor .v-download ul.download-dropdown-content li a:link{color:#2af}.librevideojs{width:90%;max-width:700px;justify-self:center}.mpv{margin-bottom:.5rem;margin-top:0}header{display:flex;width:90%;padding:20px 0px;justify-content:center}header a.drm-free{align-items:center;height:auto;opacity:.5;transition:opacity 150ms}header a.drm-free:before{content:url("../images/drm-free.png");vertical-align:top;display:block;position:absolute;top:12px;left:12px;max-width:120px;width:100%}header a.drm-free:hover{opacity:1}h2,h3,h4,h5,h6{margin-top:0;margin-bottom:0;line-height:1.1}hr{width:100%}section{width:100%}h2{text-align:center}footer p.copyleft{font-size:12px;text-align:center}@media screen and (max-width: 768px){header a.drm-free:before{display:none}} +/*# sourceMappingURL=salida.min.css.map */ diff --git a/templates/embed.tpl b/templates/embed.tpl index b29dd68..085a8bb 100644 --- a/templates/embed.tpl +++ b/templates/embed.tpl @@ -41,39 +41,46 @@ </script> </head> <body> - <video id="player" controls poster="{$librethumb}" data-setup="{}"> - {if $breaklink === TRUE} - <source data-res="{$breakquality}" src="{$breakurl}" type='{$formatdrm}'/> - {else} + {if $islive == false } + <video id="player" + poster="{$videoThumbURL}" + controls + playsinline + onmouseleave='{$videoTitle}' + oncontextmenu='{$videoTitle}' + onmouseenter='{$videoTitle}' + title='{$videoTitle}'> {foreach $streamFormats as $stream} - <source data-res="{trim($stream->resolution, 'p')}" src="{$stream->url}" type='{$stream->type}'/> + <source data-res="{trim($stream['resolution'], 'p')}" src="{$stream['url']}" type='{$stream['type']}'/> {/foreach} - {/if} - <p>Lo siento, este navegador no soporta vídeo en HTML5. Por favor, cambia o actualiza tu navegador web</p> - </video> - <!--Plyr--> - <script> - // @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later - document.addEventListener('DOMContentLoaded', () => { - const player = new Plyr(document.getElementById('player'), { - disableContextMenu: false, - controls: [ - 'play-large', - 'play', - 'progress', - 'current-time', - 'mute', - 'volume', - 'captions', - 'settings', - 'download', - 'fullscreen' - ] + <p>Lo siento, este navegador no soporta vídeo en HTML5. Por favor, cambia o actualiza tu navegador web</p> + </video> + <!--Plyr--> + <script> + // @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later + document.addEventListener('DOMContentLoaded', () => { + const player = new Plyr(document.getElementById('player'), { + disableContextMenu: false, + controls: [ + 'play-large', + 'play', + 'progress', + 'current-time', + 'mute', + 'volume', + 'captions', + 'settings', + 'download', + 'fullscreen' + ] + }); }); - }); - // @license-end - </script> - <!--EndPlyr--> + // @license-end + </script> + <!--EndPlyr--> + {else} + <p>I sorry not live support for now.</p> + {/if} <script src="{$javascript.plyr}" integrity="sha512-YjLaaKupD6GUZwnkLn8LbzL73ZhgY01zYCaeCscD/+khdOtmPfz02tw/cb9kYySUSPlpQoBT8HGY/ggiKAjA7A=="></script> </body> </html> diff --git a/templates/sass/salida.sass b/templates/sass/salida.sass index e39f9c2..e4ea057 100644 --- a/templates/sass/salida.sass +++ b/templates/sass/salida.sass @@ -21,14 +21,12 @@ a.enlace margin: auto width: 100% max-width: 800px - display: flex - flex-direction: column - flex-wrap: wrap - align-items: center + display: grid + grid-template-columns: auto + grid-template-rows: auto auto + grid-gap: 1rem .libreyt - padding-bottom: 20px - .row display: flex width: 80% @@ -36,6 +34,7 @@ a.enlace flex-direction: row flex-wrap: wrap align-items: center + justify-self: center justify-content: center .imageyt @@ -75,10 +74,22 @@ a.enlace background-color: $green border-color: $green text-decoration: none + .v-download + ul.download-dropdown-content + padding-top: 1rem + padding-bottom: 1rem + background: black + border: solid 1px #00b7f1 + li + a + text-decoration: none + &:link + color: #22aaff .librevideojs width: 90% max-width: 700px + justify-self: center .mpv margin-bottom: .5rem diff --git a/templates/video.tpl b/templates/video.tpl index dc818b8..76119f3 100644 --- a/templates/video.tpl +++ b/templates/video.tpl @@ -62,7 +62,7 @@ </div> <div class="features"> <h6 class="yt-titulo">Canal</h6> - <h6><a class="enlace" href="https://invidio.us/channel/{$videoChannel}" rel="noopener noreferrer" target="_blank">{$videoAuthor}</a></h6> + <h6>{$videoAuthor}</h6> <h6 class="yt-titulo">Duración</h6> <h6>{$videoDuration}</h6> <h6 class="yt-titulo">Vistas</h6> @@ -72,80 +72,63 @@ </div> <hr> <div class="contenedor"> - <h4>Formatos de vídeo</h4> - - {if $downloadbreak === TRUE} - <div class="row"> - <div class="col">{$downloadFormat}</div> - <div class="col">{$downloadQuality}</div> - <div class="col"> - <a class="boton-descarga" href="{$breakurl}" - title='{$videoTitle}.{$downloadFormat}' - download='{$videoTitle}.{$downloadFormat}'>Descarga Habilitada</a> - </div> - </div> - {else} - {foreach $downloads as $download} - <div class="row"> - <div class="col">{$download->container}</div> - <div class="col">{$download->resolution}</div> - <div class="col"> - <a class="boton-descarga" - title='{$videoTitle}.{$download->container}' - href="{$download->url}" - download='{$videoTitle}.{$download->container}'>Descarga</a> - </div> - </div> - {/foreach} - {/if} - - <div class="librevideojs"> - <video id="player" - poster="{$librethumb}" - controls - playsinline - onmouseleave='{$videoTitle}' - oncontextmenu='{$videoTitle}' - onmouseenter='{$videoTitle}' - title='{$videoTitle}'> - {if $islive === True} - <p> Livestream videos are not yet supported. </p> - {elseif $breaklink === TRUE} - <source data-res="{$breakquality}" src="{$breakurl}" type='{$formatdrm}'/> - {else} + {if $islive == false } + <div class="librevideojs"> + <video id="player" + poster="{$videoThumbURL}" + controls + playsinline + onmouseleave='{$videoTitle}' + oncontextmenu='{$videoTitle}' + onmouseenter='{$videoTitle}' + title='{$videoTitle}'> {foreach $streamFormats as $stream} - <source data-res="{trim($stream->resolution, 'p')}" src="{$stream->url}" type='{$stream->type}'/> + <source data-res="{trim($stream['resolution'], 'p')}" src="{$stream['url']}" type='{$stream['type']}'/> {/foreach} - {/if} - </video> - </div> - <!--Plyr--> - <script> - document.addEventListener('DOMContentLoaded', () => { - const player = new Plyr(document.getElementById('player'), { - disableContextMenu: false, - quality: { default: 360 }, - controls: [ - 'play-large', - 'play', - 'progress', - 'current-time', - 'mute', - 'volume', - 'captions', - 'settings', - 'download', - 'fullscreen' - ] + </video> + </div> + <!--Plyr--> + <script> + document.addEventListener('DOMContentLoaded', () => { + const player = new Plyr(document.getElementById('player'), { + disableContextMenu: false, + quality: { default: 360 }, + controls: [ + 'play-large', + 'play', + 'progress', + 'current-time', + 'mute', + 'volume', + 'captions', + 'settings', + 'download', + 'fullscreen' + ] + }); }); - }); - </script> - <!--EndPlyr--> + </script> + <!--EndPlyr--> + <details class="v-download"> + <summary class="download-dropdown-label">Download</summary> + <ul class="download-dropdown-content"> + {foreach $streamFormats as $download} + <li class="download-format"> + <a class="boton-descarga" href="{$download['url']}"> + {$download['format']} + </a> + </li> + {/foreach} + </ul> + </details> + {else} + <p>I sorry not live support for now.</p> + {/if} </div> </section> - <code>{$url_freedom}</code> + <code>{$url_query}</code> <code> - <iframe width='560' height='315' src='{$local_url}embed?link={$url_freedom}' frameborder='0' scrolling='no'></iframe> + <iframe width='560' height='315' src='{$local_url}embed?link={$url_query}' frameborder='0' scrolling='no'></iframe> </code> <footer> <p class="copyleft">Esta web es Software Libre y esta disponible en <a class="enlace" diff --git a/tools/extract.php b/tools/extract.php new file mode 100644 index 0000000..2b06a5f --- /dev/null +++ b/tools/extract.php @@ -0,0 +1,518 @@ +<?php + +$id = $video_id; + +function getc($url) { + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + $data = curl_exec($ch); + curl_close($ch); + + return $data; +} + +function cut_yt($ganti) { + $arayganti = array('Youtube','youtube','YouTube'); + $ganti = str_replace($arayganti,'',$ganti); + return $ganti; +} + +function exformat($itag) { + switch ($itag) { + case "5": + return "flv, video, 240p, audio"; + break; + case "6": + return "flv, video, 270p, audio"; + break; + case "13": + return "3gp, video, audio"; + break; + case "17": + return "3gp, video, 144p, audio"; + break; + case "18": + return "mp4, video, 360p, audio"; + break; + case "22": + return "mp4, video, 720p, audio"; + break; + case "34": + return "flv, video, 360p, audio"; + break; + case "35": + return "flv, video, 480p, audio"; + break; + case "36": + return "3gp, video, audio"; + break; + case "37": + return "mp4, video, 1080p, audio"; + break; + case "38": + return "mp4, video, 3072p, audio"; + break; + case "43": + return "webm, video, 360p, audio"; + break; + case "44": + return "webm, video, 480p, audio"; + break; + case "45": + return "webm, video, 720p, audio"; + break; + case "46": + return "webm, video, 1080p, audio"; + break; + case "59": + return "mp4, video, 480p, audio"; + break; + case "78": + return "mp4, video, 480p, audio"; + break; + case "82": + return "mp4, video, 360p, audio"; + break; + case "83": + return "mp4, video, 480p, audio"; + break; + case "84": + return "mp4, video, 720p, audio"; + break; + case "85": + return "mp4, video, 1080p, audio"; + break; + case "100": + return "webm, video, 360p, audio"; + break; + case "101": + return "webm, video, 480p, audio"; + break; + case "102": + return "webm, video, 720p, audio"; + break; + case "91": + return "mp4, video, 144p, audio"; + break; + case "92": + return "mp4, video, 240p, audio"; + break; + case "93": + return "mp4, video, 360p, audio"; + break; + case "94": + return "mp4, video, 480p, audio"; + break; + case "95": + return "mp4, video, 720p, audio"; + break; + case "96": + return "mp4, video, 1080p, audio"; + break; + case "132": + return "mp4, video, 240p, audio"; + break; + case "151": + return "mp4, video, 72p, audio"; + break; + case "133": + return "mp4, video, 240p"; + break; + case "134": + return "mp4, video, 360p"; + break; + case "135": + return "mp4, video, 480p"; + break; + case "136": + return "mp4, video, 720p"; + break; + case "137": + return "mp4, video, 1080p"; + break; + case "138": + return "mp4, video"; + break; + case "160": + return "mp4, video, 144p"; + break; + case "212": + return "mp4, video, 480p"; + break; + case "264": + return "mp4, video, 1440p"; + break; + case "298": + return "mp4, video, 720p"; + break; + case "299": + return "mp4, video, 1080p"; + break; + case "266": + return "mp4, video, 2160p"; + break; + case "139": + return "m4a, audio"; + break; + case "140": + return "m4a, audio"; + break; + case "141": + return "m4a, audio"; + break; + case "256": + return "m4a, audio"; + break; + case "258": + return "m4a, audio"; + break; + case "325": + return "m4a, audio"; + break; + case "328": + return "m4a, audio"; + break; + case "167": + return "webm, video, 360p"; + break; + case "168": + return "webm, video, 480p"; + break; + case "169": + return "webm, video, 720p"; + break; + case "170": + return "webm, video, 1080p"; + break; + case "218": + return "webm, video, 480p"; + break; + case "219": + return "webm, video, 480p"; + break; + case "278": + return "webm, video, 144p"; + break; + case "242": + return "webm, video, 240p"; + break; + case "243": + return "webm, video, 360p"; + break; + case "244": + return "webm, video, 480p"; + break; + case "245": + return "webm, video, 480p"; + break; + case "246": + return "webm, video, 480p"; + break; + case "247": + return "webm, video, 720p"; + break; + case "248": + return "webm, video, 1080p"; + break; + case "271": + return "webm, video, 1440p"; + break; + case "272": + return "webm, video, 2160p"; + break; + case "302": + return "webm, video, 720p"; + break; + case "303": + return "webm, video, 1080p"; + break; + case "308": + return "webm, video, 1440p"; + break; + case "313": + return "webm, video, 2160p"; + break; + case "315": + return "webm, video, 2160p"; + break; + case "171": + return "webm, audio"; + break; + case "249": + return "webm, audio"; + break; + case "250": + return "webm, audio"; + break; + case "251": + return "webm, audio"; + break; + case "394": + return "video"; + break; + case "395": + return "video"; + break; + case "396": + return "video"; + break; + case "397": + return "video"; + break; + default: + return $itag; + break; + } +} + +$a = getc('https://www.youtube.com/embed/'.$id); + +$ccc=explode('s/player/', $a); +$ddd=explode('/www-player.css', $ccc[1]); + +$gsts = file_get_contents('https://www.youtube.com/s/player/'.$ddd[0].'/player_ias.vflset/en_US/base.js'); + +function getchiper($decipherScript) { + $decipherPatterns = explode('.split("")', $decipherScript); + unset($decipherPatterns[0]); + foreach ($decipherPatterns as $value) { + $value = explode('.join("")', explode('}', $value)[0]); + if (count($value) === 2) { + $value = explode(';', $value[0]); + array_pop($value); + unset($value[0]); + $decipherPatterns = implode(';', $value); + break; + } + } + preg_match_all('/(?<=;).*?(?=\[|\.)/', $decipherPatterns, $deciphers); + if ($deciphers && count($deciphers[0]) >= 2) { + $deciphers = $deciphers[0][0]; + $deciphersObjectVar = $decipherPatterns ; + $decipher = explode($deciphers . '={', $decipherScript)[1]; + $decipher = str_replace(["\n", "\r"], '', $decipher); + $decipher = explode('}};', $decipher)[0]; + $decipher = explode('},', $decipher); + // Convert deciphers to object + $deciphers = []; + + foreach ($decipher as &$function) { + $deciphers[explode(':function', $function)[0]] = explode('){', $function)[1]; + } + // Convert pattern to array + $decipherPatterns = str_replace($deciphersObjectVar . '.', '', $decipherPatterns); + $decipherPatterns = str_replace($deciphersObjectVar . '[', '', $decipherPatterns); + $decipherPatterns = str_replace(['](a,', '(a,'], '->(', $decipherPatterns); + $decipherPatterns = explode(';', $decipherPatterns); + $patterns =$decipherPatterns; + $deciphers =$deciphers; + + if (!file_exists(TOOLS_PATH.'sig.php')) { + + for ($i=0; $i < count($patterns); $i++) { + $executes = explode('->', $patterns[$i]); + $execute=explode('.', $executes[0]); + $number = intval(str_replace(['(', ')'], '', $executes[1])); + $execute = $deciphers[$execute[1]]; + switch ($execute) { + case 'a.reverse()': + $processSignature = '$reverse'; + break; + case 'var c=a[0];a[0]=a[b%a.length];a[b]=c': + $processSignature= '$length'; + break; + case 'var c=a[0];a[0]=a[b%a.length];a[b%a.length]=c': + $processSignature= '$lengtha'; + break; + case 'a.splice(0,b)': + $processSignature= '$splice'; + break; + default: + die("\n==== Decipher dictionary was not found ===="); + break; + } + $myfile = fopen(TOOLS_PATH.'sig.php', "a+") or die("Unable to open file!"); + if ($i==0) { + fwrite($myfile, '<?php $a = str_split($s);'); + } + fwrite($myfile, $processSignature.'($a,'.$number.');'); + fclose($myfile); + } + + } + } +} + +function sig($s){ + $reverse=function(&$a){ + $a = array_reverse($a); + }; + $splice=function(&$a, $b){ + $a = array_slice($a, $b); + }; + $length = function(&$a, $b){ + $c = $a[0]; + $a[0] = $a[$b % count($a)]; + $a[$b] = $c; + }; + $lengtha = function(&$a, $b){ + $c = $a[0]; + $a[0] = $a[$b%count($a)]; + $a[$b%count($a)] = $c; + }; + + include(TOOLS_PATH.'sig.php'); + return join('', $a); +} + + +getchiper($gsts); +$data = getc("https://www.youtube.com/get_video_info?video_id=".$id."&asv=3&el=detailpage&hl=en_US"); +parse_str($data,$info); +$streams = $info['player_response']; +$jsn_str = str_replace("\u0026","&", $streams); +$streamin_data_json = json_decode($jsn_str, true); + +// Microdata +$vidtitle = $streamin_data_json["videoDetails"]["title"]; +$vidId = $streamin_data_json["videoDetails"]["videoId"]; +$viddes = $streamin_data_json["microformat"]["playerMicroformatRenderer"]["description"]["simpleText"]; +$vidpub = $streamin_data_json["microformat"]["playerMicroformatRenderer"]["publishDate"]; +$vidviewCount = $streamin_data_json["videoDetails"]["viewCount"]; +$vidauthor = $streamin_data_json["videoDetails"]["author"]; +$vidauthorid = $streamin_data_json["videoDetails"]["channelId"]; +$vidauthourl = "channel/{$vidauthorid}"; +$vidtime = $streamin_data_json["videoDetails"]["lengthSeconds"]; +$vidisLiveContent = $streamin_data_json["videoDetails"]["isLiveContent"]; + +// thumbs +$vidthumb = array(); +foreach ($streamin_data_json["videoDetails"]["thumbnail"]["thumbnails"] as $data) { + $url = $data['url']; + $values = array( + 'url' => $url, + 'width' => $data['width'], + 'height' => $data['height'] + ); + array_push($vidthumb, $values); +} + +// keywords +$vidkeywords = array(); +if ( isset($streamin_data_json["videoDetails"]["keywords"]) ) { + foreach ($streamin_data_json["videoDetails"]["keywords"] as $data) { + array_push($vidkeywords, $data); + } +} + +// streams +if (isset($streamin_data_json["streamingData"])) { + + $strF=$streamin_data_json["streamingData"]["formats"]; + $strA=$streamin_data_json["streamingData"]["adaptiveFormats"]; + + $vdef = array(); + foreach ($strF as $stream) { + if (isset($stream["signatureCipher"])) { + parse_str($stream["signatureCipher"],$dturl); + $values = array( + 'url' => $dturl['url'].'&sig='.sig($dturl['s']), + 'itag' => $stream['itag'], + 'type' => $stream['mimeType'], + 'quality' => $stream['quality'], + 'fps' => $stream['fps'], + 'resolution' => $stream['qualityLabel'], + 'qualityLabel' => $stream['qualityLabel'], + 'format' => exformat($stream['itag']) + ); + array_push($vdef, $values); + } else { + if (!empty($strF['url'])) { + $values = array( + 'url' => $strF['url'], + ); + array_push($vdef, $values); + } + } + } + + $aud = array(); + $vid = array(); + foreach ($strF as $stream) { + if (isset( $stream['url'] )) { + if (preg_match('/video/', $stream['mimeType'])) { + $url = $stream['url']; + $values = array( + 'url' => $url, + 'itag' => $stream['itag'], + 'type' => $stream['mimeType'], + 'quality' => $stream['quality'], + 'fps' => $stream['fps'], + 'resolution' => $stream['qualityLabel'], + 'qualityLabel' => $stream['qualityLabel'], + 'format' => exformat($stream['itag']), + ); + array_push($vid, $values); + } + } + } + foreach ($strA as $stream) { + if (isset($stream["signatureCipher"])) { + parse_str($stream["signatureCipher"],$dturl); + $stream['url']=$dturl['url'].'&sig='.sig($dturl['s']); + } + + if (preg_match('/audio/', $stream['mimeType'])) { + $url = $stream['url']; + $values = array( + 'url' => $url, + 'itag' => $stream['itag'], + 'type' => $stream['mimeType'], + 'quality' => $stream['quality'], + 'format' => exformat($stream['itag']), + ); + array_push($aud, $values); + } + + if (preg_match('/video/', $stream['mimeType'])) { + $url = $stream['url']; + $values = array( + 'url' => $url, + 'itag' => $stream['itag'], + 'type' => $stream['mimeType'], + 'quality' => $stream['quality'], + 'fps' => $stream['fps'], + 'resolution' => $stream['qualityLabel'], + 'qualityLabel' => $stream['qualityLabel'], + 'format' => exformat($stream['itag']), + ); + array_push($vid, $values); + } + } + +} else { + $vdef = array(); + $aud = array(); + $vid = array(); +} + +// $json['title']=$vidtitle; +// $json['videoId']=$vidId; +// $json['videoThumbnails']=$vidthumb; +// $json['description']=$viddes; +// $json['publishedText']=$vidpub; +// $json['viewCount']=$vidviewCount; +// $json['keywords']=$vidkeywords; +// $json['author']=$vidauthor; +// $json['authorId']=$vidauthorid; +// $json['authorUrl']=$vidauthourl; +// $json['lengthSeconds']=$vidtime; +// $json['liveNow']=$vidisLiveContent; +// $json['default']=$vdef; +// $json['audio']=$aud; +// $json['video']=$vid; diff --git a/tools/processor.php b/tools/processor.php index c3afdd1..a490d32 100644 --- a/tools/processor.php +++ b/tools/processor.php @@ -1,11 +1,6 @@ <?php require_once "init.php"; -$instance = [ - "snopyta" => "https://invidious.snopyta.org", - "glie" => "https://invidious.glie.town", -]; - if ( empty( $_GET['link'] ) ){ header( 'Location: index.php' ); } @@ -23,6 +18,7 @@ if ( $urlexists === TRUE ) { invidiou[.]sh| invidious[.]kabi[.]tk| invidious[.]glie[.]town| + invidious[.]zapashcanon[.]fr| yotter[.]conocimientoslibres[.]ga| invidious[.]snopyta[.]org)) # URL supports (\/(?:[\w\-]+\?v=|embed\/|v\/)?) # Parameters (embed, v) @@ -40,104 +36,22 @@ if ( $urlexists === TRUE ) { header( 'Location: index.php' ); } -// servers JSON -$invidio0 = "{$instance['snopyta']}/api/v1/videos/{$video_id}"; -$invidio1 = "{$instance['glie']}/api/v1/videos/{$video_id}"; - -$invidio0on = url_exists( $invidio0 ); -$invidio1on = url_exists( $invidio1 ); - -// check servers -if ( $invidio0on === TRUE ) { - $video_string = file_get_contents( $invidio0 ); -} elseif ( $invidio1on === TRUE ) { - $video_string = file_get_contents( $invidio1 ); -} else { - header( 'Location: index.php' ); -} - -$video_info = json_decode( $video_string ); - -$videoTitle = $video_info->title; -$videoAuthor = $video_info->author; -$videoDurationSecs = $video_info->lengthSeconds; -$videoDuration = secToDuration( $videoDurationSecs ); -$videoChannel = $video_info->authorId; - -// Begin_ViewCount -$extract_video_view = $video_info->viewCount; -$videoViews = bytes( $extract_video_view ); -// End_ViewCount - -// change hqdefault.jpg to default.jpg for downgrading the thumbnail quality -$videoThumbURL = "https://i1.ytimg.com/vi/{$video_id}/hqdefault.jpg"; -$librethumb = $video_info->videoThumbnails[0]->url; - -// Extract videos from JSON -$streamFormats = $video_info->formatStreams; - -// Downloads -$downloads = $video_info->formatStreams; +// Core API +require_once "extract.php"; -// Live -$islive = $video_info->liveNow; +$videoTitle=$vidtitle; +$videoThumbURL = "https://i.ytimg.com/vi/{$video_id}/hqdefault.jpg"; +$videoDuration = secToDuration($vidtime); +$videoViews = bytes( $vidviewCount ); +$islive = $vidisLiveContent; -///// Beaking DRM!!! -// Check standar video into URL -if ( $islive === FALSE ) { - $url_standar = $streamFormats[0]->url; +if (!empty($vdef)) { + $streamFormats = $vdef; } else { - $url_standar = FALSE; + $streamFormats = $vid; } -if ( $url_standar === FALSE ) { - // nodes - $node0 = "{$instance['snopyta']}/latest_version?id={$video_id}&itag=18&local=true"; - $node1 = "{$instance['glie']}/latest_version?id={$video_id}&itag=18&local=true"; - - // explain DRM - $drmv = "https://archive.org/download/libreweb/rms-drm.webm"; - - $node0on = video_exists( $node0 ); - $node1on = video_exists( $node1 ); - - // check nodes - if ( $node0on === TRUE ) { - $breakurl = $node0; - } elseif ( $node1on === TRUE ) { - $breakurl = $node1; - } else { - $breakurl = $drmv; - $formatdrm = 'video/webm'; - } - - // format video DRM - if ( $islive === FALSE ) { - $formatdrm = $streamFormats[0]->type; - $breakquality = trim( $streamFormats[0]->resolution, 'p' ); - $downloadQuality = $streamFormats[0]->resolution; - $downloadFormat = $downloads[0]->container; - } else { - $formatdrm = NULL; - $breakquality = NULL; - $downloadQuality = NULL; - $downloadFormat = NULL; - } - - $breaklink = TRUE; - $downloadbreak = TRUE; - -} else { - // clean variables - $breakurl = NULL; - $breaklink = NULL; - $breakquality = NULL; - $downloadbreak = NULL; - $downloadFormat = NULL; - $downloadQuality = NULL; - $formatdrm = NULL; -} -///// End Beaking DRM!!! +$videoAuthor = $vidauthor; /* ---- ---- Generated URL and embed ---- ---- */ if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) { @@ -151,5 +65,5 @@ $subject = $pro."://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; // Local URL $local_url = preg_replace( '/index.php/', '', $subject ); -/* ---- ---- Change to Freedom URL ---- ---- */ -$url_freedom = "{$instance['snopyta']}/watch?v={$video_id}"; +/* ---- ---- URL Query ---- ---- */ +$url_query = "{$baselink}"; diff --git a/tools/sig.php b/tools/sig.php new file mode 100644 index 0000000..53b1336 --- /dev/null +++ b/tools/sig.php @@ -0,0 +1 @@ +<?php $a = str_split($s);$lengtha($a,26);$lengtha($a,1);$reverse($a,35);$splice($a,2);$reverse($a,57);
\ No newline at end of file |