Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##################################################################################
- index.php
- ##################################################################################
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title></title>
- </head>
- <body>
- <div id="tmp">
- <input type="text" id="slug" placeholder="slug do anime" value="shingeki-no-kyojin">
- <input type="text" id="count" placeholder="número de eps" value="36">
- <button type="button" id="processar">Processar</button>
- <ul id="list-eps">
- </ul>
- </div>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
- <script type="text/javascript">
- var api = {};
- api.grab_gid = function(uri){
- $.ajax({
- url: 'api.php',
- method: 'post',
- async: false,
- data: {
- action: 'download',
- url: uri
- },
- success: function(data){
- window.episodios.push(data);
- var index = window.episodios.length;
- $('#list-eps').append('<li>Ep ' + index + ': <a href="' + data + '" target="_blank">' + data + '</a></li>');
- },
- error: function(data){
- console.log(data);
- }
- });
- }
- // DOM: On Ready
- $(document).ready(function(){
- // Ação ao clicar em "Processar"
- $(document).on('click', '#processar', function(){
- var slug = $('#slug').val();
- var count = $('#count').val();
- window.episodios = [];
- var index = 1;
- function grab(){
- api.grab_gid('https://www.superanimes.site/anime/' + slug + '/episodio-' + index + '/baixar');
- console.log('Ep ' + index + ': capturado!');
- if (index++ < count) setTimeout(grab, 500);
- if (index >= count && window.episodios.length == count){
- console.log('Grab finalizado!');
- console.log(window.episodios);
- }
- }
- grab();
- });
- });
- </script>
- </body>
- </html>
- ############################################################################################################
- api.php
- ############################################################################################################
- <?php
- function returnJSON($content = null, $code = 200){
- header('Cache-Control: no-cache, must-revalidate');
- header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
- header('Content-type: application/json');
- $status = array(
- 200 => '200 OK',
- 400 => '400 Bad Request',
- 422 => '422 Unprocessable Entity',
- 500 => '500 Internal Server Error'
- );
- header('Status', true, (in_array($code, $status)) ? $code : 500);
- echo json_encode($content);
- exit(0);
- }
- if(isset($_POST['action']) && $_POST['action'] == "download"){
- $html = file_get_contents($_POST['url']);
- $g_id = base64_decode(explode('&token=', explode('https://www.superanimes.site/download.php?file=', $html)[1])[0]);
- $g_url = "https://www.blogger.com/video-play.mp4?contentId={$g_id}";
- returnJSON($g_url, 200);
- }
- if(isset($_POST['action']) && $_POST['action'] == "count"){
- $html = file_get_contents($_POST['url']);
- $count = explode('</span>', explode('<span itemprop="numberofEpisodes">', $html)[1])[0];
- returnJSON($count, 200);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment