forked from sergiotarxz/Peertube-dl
Adding ability to use the program as module and tests.
This commit is contained in:
parent
beec75b418
commit
b5488d5503
5
MANIFEST
5
MANIFEST
@ -1,10 +1,15 @@
|
||||
.proverc
|
||||
AUTHORS
|
||||
bin/peertube-dl
|
||||
cpanfile
|
||||
lib/Peertube/DL/Downloaders.pm
|
||||
lib/Peertube/DL/URLHandler.pm
|
||||
lib/Peertube/DL/UserAgent.pm
|
||||
lib/Peertube/DL/Utils.pm
|
||||
LICENSE
|
||||
Makefile.PL
|
||||
MANIFEST This list of files
|
||||
README.md
|
||||
t/00-use_ok.t
|
||||
t/downloaders/animeflv_example_response.html
|
||||
t/downloaders/gocdn.t
|
||||
|
@ -3,5 +3,7 @@ use ExtUtils::MakeMaker;
|
||||
WriteMakefile(
|
||||
NAME => 'Peertube::DL',
|
||||
VERSION => '0.1',
|
||||
INST_SCRIPT => './bin'
|
||||
INST_SCRIPT => './bin',
|
||||
test => { TESTS => 't/*.t' },
|
||||
test => { TESTS => 't/*/*.t' },
|
||||
);
|
||||
|
@ -5,30 +5,20 @@ use feature 'say';
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Peertube::DL::UserAgent;
|
||||
use Peertube::DL::Downloaders;
|
||||
|
||||
my $ua = Peertube::DL::UserAgent->new( timeout => 10 );
|
||||
$ua->agent('Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0');
|
||||
my $response = $ua->get( $ARGV[0] );
|
||||
my %handlers = (
|
||||
gocdn => { reg => qr/gocdn\.html#/, subr => \&Peertube::DL::Downloaders::gocdn },
|
||||
animeid => { reg => qr/animeid\.to\/streaming\.php\?/, subr => \&Peertube::DL::Downloaders::animeid },
|
||||
);
|
||||
use Peertube::DL::URLHandler;
|
||||
|
||||
die "No url passed" unless @ARGV;
|
||||
|
||||
my $handled = 0;
|
||||
for my $x ( keys %handlers ) {
|
||||
if ( $response->decoded_content =~ m/$handlers{$x}{reg}/ ) {
|
||||
eval { $handlers{$x}{subr}->( $ua, $response ); };
|
||||
if ($@) {
|
||||
say $@;
|
||||
} else {
|
||||
$handled = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
my $download_data = Peertube::DL::URLHandler::getDownloadDataFromURL( $ARGV[0] );
|
||||
my $filename = $download_data->{filename};
|
||||
my $url = $download_data->{url};
|
||||
my $ua = Peertube::DL::URLHandler::generateUA();
|
||||
my $response = $ua->get($url);
|
||||
|
||||
say "The url could not be handled, post a issue on https://gitea.sergiotarxz.freemyip.com/sergiotarxz/Peertube-dl/issues telling me the url which does not allow you to download the video so I add support for it." unless $handled;
|
||||
die "Cannot retrieve video data" unless $response->is_success;
|
||||
|
||||
my $content = $response->decoded_content;
|
||||
|
||||
open my $fh, '>', $filename or die "Cannot open $filename";
|
||||
$fh->print( $response->decoded_content ) or die "Cannot write to $filename";
|
||||
close $fh;
|
||||
|
3
cpanfile
3
cpanfile
@ -2,3 +2,6 @@ requires 'LWP::UserAgent';
|
||||
requires 'URI::Encode';
|
||||
requires 'JSON';
|
||||
requires 'LWP::Protocol::https';
|
||||
requires 'Mojolicious::Lite';
|
||||
requires 'Test::Most';
|
||||
requires 'Test::MockObject';
|
||||
|
@ -23,28 +23,16 @@ sub gocdn {
|
||||
|
||||
my $google_url = JSON::decode_json( $response_gocdn->decoded_content )->{file};
|
||||
|
||||
my ($filename) = $ARGV[0] =~ s/^.*\///gr . '.mp4';
|
||||
my ($filename) = $response->base =~ s/^.*\///gr . '.mp4';
|
||||
|
||||
say "Descargando desde $google_url.";
|
||||
my $response_google = $ua->get($google_url);
|
||||
|
||||
die $response_google->status_line . ' from ' . $google_url unless $response_google->is_success;
|
||||
|
||||
open my $fh, '>', $filename;
|
||||
|
||||
say "Imprimiendo la respuesta en el fichero.";
|
||||
$fh->print( $response_google->decoded_content );
|
||||
|
||||
close $fh;
|
||||
|
||||
say "$filename descargado.";
|
||||
return { url => $google_url, filename => $filename };
|
||||
}
|
||||
|
||||
sub animeid {
|
||||
my $ua = shift;
|
||||
my $response = shift;
|
||||
my @order = ( 'id', 'title', 'refer' );
|
||||
my $url = $ARGV[0];
|
||||
my $url = $response->base;
|
||||
my $url_ajax = 'https://animeid.to/ajax.php?';
|
||||
my ($get_params) = $response->decoded_content =~ /animeid\.to\/streaming\.php\?(.*?)"/;
|
||||
$get_params = {
|
||||
@ -71,22 +59,24 @@ sub animeid {
|
||||
say "Decoding json... $ajax_data";
|
||||
$ajax_data = JSON::decode_json $ajax_data;
|
||||
die 'No video source found.' if ( !defined $ajax_data->{source} );
|
||||
my $download_url = $ajax_data->{source}[0]{file} // die "No url found.";
|
||||
my $extension = $ajax_data->{source}[0]{type} // die "No extension found.";
|
||||
my $download_redirect_url = $ajax_data->{source}[0]{file} // die "No url found.";
|
||||
my $extension = $ajax_data->{source}[0]{type} // die "No extension found.";
|
||||
$filename .= ".$extension";
|
||||
say "Downloading video from $download_url...";
|
||||
say "Getting redirect to download url from $download_redirect_url...";
|
||||
my $video_response = $ua->get(
|
||||
$download_url,
|
||||
$download_redirect_url,
|
||||
Referer => $url,
|
||||
Host => 'animeid.to',
|
||||
);
|
||||
if ( $video_response->is_success ) {
|
||||
open my $fh, '>', $filename;
|
||||
$fh->print( $video_response->decoded_content );
|
||||
close $fh;
|
||||
say $filename;
|
||||
if ( $video_response->is_redirect ) {
|
||||
my $video_location = $video_response->header('Location');
|
||||
die "No redirection." unless $video_location;
|
||||
return {
|
||||
url => $video_location,
|
||||
filename => $filename,
|
||||
};
|
||||
} else {
|
||||
die 'Video download failed because: ' . $video_response->status_line;
|
||||
die 'Getting redirect failed because: ' . $video_response->status_line;
|
||||
}
|
||||
}
|
||||
1;
|
||||
|
49
lib/Peertube/DL/URLHandler.pm
Normal file
49
lib/Peertube/DL/URLHandler.pm
Normal file
@ -0,0 +1,49 @@
|
||||
package Peertube::DL::URLHandler;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use feature 'say';
|
||||
|
||||
use Peertube::DL::UserAgent;
|
||||
use Peertube::DL::Downloaders;
|
||||
|
||||
sub getDownloadDataFromURL {
|
||||
my $url_origen = shift;
|
||||
my $ua = Peertube::DL::URLHandler::generateUA();
|
||||
my $response = $ua->get($url_origen);
|
||||
my %handlers = (
|
||||
gocdn => { reg => qr/gocdn\.html#/, subr => \&Peertube::DL::Downloaders::gocdn },
|
||||
animeid => { reg => qr/animeid\.to\/streaming\.php\?/, subr => \&Peertube::DL::Downloaders::animeid },
|
||||
);
|
||||
|
||||
my $handled = 0;
|
||||
my $download_data;
|
||||
for my $x ( keys %handlers ) {
|
||||
if ( $response->decoded_content =~ m/$handlers{$x}{reg}/ ) {
|
||||
eval { $download_data = $handlers{$x}{subr}->( $ua, $response ); };
|
||||
if ($@) {
|
||||
warn $@;
|
||||
} else {
|
||||
$handled = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
die
|
||||
"The url could not be handled, post a issue on https://gitea.sergiotarxz.freemyip.com/sergiotarxz/Peertube-dl/issues telling me the url which does not allow you to download the video so I add support for it."
|
||||
unless $handled;
|
||||
die "Download data not defined" unless defined $download_data;
|
||||
die "Download data not hashref" unless ref($download_data) eq 'HASH';
|
||||
die "Filename not defined" unless exists $download_data->{filename} && $download_data->{filename};
|
||||
die "Download url not defined" unless exists $download_data->{url} && defined $download_data->{url};
|
||||
return $download_data;
|
||||
}
|
||||
|
||||
sub generateUA {
|
||||
my $ua = Peertube::DL::UserAgent->new( timeout => 10 );
|
||||
$ua->agent('Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0');
|
||||
$ua;
|
||||
}
|
||||
1;
|
@ -12,13 +12,22 @@ use parent 'LWP::UserAgent';
|
||||
my $last_progress_time;
|
||||
|
||||
sub redirect_ok {
|
||||
1;
|
||||
my $self = shift;
|
||||
return $self->{peertube_redirect_ok};
|
||||
}
|
||||
|
||||
sub set_redirect_ok {
|
||||
my $self = shift;
|
||||
return $self->{peertube_redirect_ok} = shift;
|
||||
}
|
||||
|
||||
sub progress {
|
||||
my $self = shift;
|
||||
my $status = shift;
|
||||
my $response = shift;
|
||||
|
||||
$self->{peertube_redirect_ok} = 0;
|
||||
|
||||
if ( !defined $last_progress_time || time > $last_progress_time + 1 ) {
|
||||
$last_progress_time = time;
|
||||
if ( $response->isa('HTTP::Response') && $status =~ /^\d/ ) {
|
||||
|
11
t/00-use_ok.t
Normal file
11
t/00-use_ok.t
Normal file
@ -0,0 +1,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use feature 'say';
|
||||
|
||||
use Test::Most tests => 4;
|
||||
|
||||
use_ok 'Peertube::DL::URLHandler';
|
||||
use_ok 'Peertube::DL::Utils';
|
||||
use_ok 'Peertube::DL::UserAgent';
|
||||
use_ok 'Peertube::DL::Downloaders';
|
370
t/downloaders/animeflv_example_response.html
Normal file
370
t/downloaders/animeflv_example_response.html
Normal file
@ -0,0 +1,370 @@
|
||||
<!doctype html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Digimon Adventure: (2020) Episodio 30 Sub Español — AnimeFLV</title>
|
||||
<meta name="description" content="Ver Digimon Adventure: (2020) Episodio 30 Sub Español, descargar Digimon Adventure: (2020) Episodio 30 gratis, Digimon Adventure: (2020) Episodio 30 en calidad HD.">
|
||||
<meta property="og:title" content="Digimon Adventure: (2020) Episodio 30" />
|
||||
<meta property="og:url" content="/ver/digimon-adventure-2020-30" />
|
||||
<meta property="og:image" content="https://cdn.animeflv.net/screenshots/3297/30/3.jpg" />
|
||||
<meta property="og:site_name" content="AnimeFLV" />
|
||||
<meta property="og:description" content="Estoy viendo Digimon Adventure: (2020) Episodio 30 Completo en Calidad HD, completamente Gratis!" />
|
||||
<link rel="canonical" href="https://www3.animeflv.net/ver/digimon-adventure-2020-30" />
|
||||
<link rel="alternate" media="only screen and (max-width: 640px)" href="https://m.animeflv.net/ver/digimon-adventure-2020-30">
|
||||
<meta name="robots" content="index, nofollow">
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700,400italic' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="/assets/animeflv/css/font-awesome.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/assets/animeflv/css/css.css?v=1.2.6" />
|
||||
<link rel="stylesheet" type="text/css" href="/assets/animeflv/css/bootstrap.css" />
|
||||
<script type="text/javascript" src="/assets/animeflv/js/modernizr.js"></script>
|
||||
<script src="https://apis.google.com/js/platform.js"></script>
|
||||
<meta name="verify-admitad" content="34e2b77cc8" />
|
||||
<meta content='es' http-equiv='content-language' />
|
||||
<meta content='es' name='language' />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta property="fb:app_id" content="1730508916998105" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="9466b52c-dbbb-463c-ac6c-b176877cab25" data-blockingmode="auto" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="fb-root"></div>
|
||||
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/es_LA/sdk.js#xfbml=1&version=v6.0&appId=1730508916998105&autoLogAppEvents=1"></script>
|
||||
<script src="/js/ads.js"></script>
|
||||
|
||||
<div class="Wrapper">
|
||||
|
||||
<header class="Header">
|
||||
<div class="Mid">
|
||||
<div class="Container">
|
||||
<div class="AX Row AFluid">
|
||||
<div class="Logo">
|
||||
<a href="/"><img src="/assets/animeflv/img/logo.png?v=2.3" alt="AnimeFLV" /></a>
|
||||
</div>
|
||||
<div class="AFixed">
|
||||
<input type="checkbox" hidden="hidden" id="BtnMenu">
|
||||
<label for="BtnMenu" class="BtnMenu fa-bars"><span>MENU</span></label>
|
||||
<nav class="CX Row">
|
||||
<input type="checkbox" hidden="hidden" id="Hd-Search">
|
||||
<div class="Search">
|
||||
<form action="/browse" method="get">
|
||||
<input name="q" type="text" id="search-anime" autocomplete="off" placeholder="Buscar...">
|
||||
<button><i class="fa-search"></i></button>
|
||||
</form>
|
||||
<div class="DpdwCnt TtCn">
|
||||
<ul class="ListResult"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Login">
|
||||
<input type="checkbox" hidden="hidden" id="DpdwLnk-Login">
|
||||
<label for="DpdwLnk-Login" class="Button"><span class="fa-user">Login</span></label>
|
||||
<div class="DpdwCnt TtCn">
|
||||
<div class="Title">INICIAR SESION</div>
|
||||
<form action="/auth/sign_in" class="form-horizontal" method="POST"> <label class="Form-Icon Right">
|
||||
<input name="email" type="text" placeholder="E-Mail">
|
||||
<i class="fa-user"></i>
|
||||
</label>
|
||||
<label class="Form-Icon Right">
|
||||
<input name="password" type="password" placeholder="Contraseña">
|
||||
<input type="hidden" name="remember_me" value="1">
|
||||
<i class="fa-lock"></i>
|
||||
</label>
|
||||
<button type="submit">INICIAR SESIÓN</button>
|
||||
<a href="/auth/facebook/sign_in" rel="nofollow" class="Button fb_login"><span class="fa-facebook">INICIAR SESION CON FB</span></a>
|
||||
<div class="Links">
|
||||
<a href="/auth/sign_up" rel="nofollow">Registrate</a>
|
||||
<a href="/auth/password/new" rel="nofollow">¿Olvidaste tu contraseña?</a>
|
||||
</div>
|
||||
</form> </div>
|
||||
</div>
|
||||
<ul class="Menu">
|
||||
<li><a href="/">Inicio</a></li>
|
||||
<li><a href="/browse">Directorio Anime</a></li>
|
||||
</ul>
|
||||
<ul class="ListSocial BFixed">
|
||||
<li><a href="https://www.facebook.com/AnimeFLV/" rel="nofollow" target="_blank" class="fa-facebook"></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
<div class="Body">
|
||||
<div class="Container">
|
||||
<div class="CpCn ClFx" id="XpndCn">
|
||||
<div class="CpCnA">
|
||||
<span class="lgtbx"></span>
|
||||
<nav class="Brdcrmb fa-home">
|
||||
<a href="/" title="Inicio AnimeFLV">Inicio</a> <i class="fa-caret-right"></i> <a href="/anime/digimon-adventure-2020">Digimon Adventure: (2020) </a> <i class="fa-caret-right"></i> <strong>Digimon Adventure: (2020) Episodio 30</strong>
|
||||
</nav>
|
||||
|
||||
<div class="CapiTop">
|
||||
<h1 class="Title" title="Digimon Adventure: (2020) Episodio 30">Digimon Adventure: (2020) Episodio 30</h1>
|
||||
<h2 class="SubTitle">Episodio 30</h2>
|
||||
<div class="lang-op"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<ul class="CapiTnv nav nav-pills" role="tablist" data-toggle="pills"></ul>
|
||||
|
||||
<div class="CapiTcn tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="video_box" style="background: #000; color: #fff;">
|
||||
Actualmente no hay vídeos
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="CpCnB">
|
||||
<div class="CapOptns ClFx show">
|
||||
<div class="CapNv">
|
||||
<a href="/ver/digimon-adventure-2020-29" class="CapNvPv fa-chevron-left">ANTERIOR</a> <a href="/anime/digimon-adventure-2020" class="CapNvLs fa-th-list"></a>
|
||||
</div>
|
||||
<a href="#" class="BtnNw Rprt BxSdw fa-flag-o" data-toggle="modal" data-target="#ReportModal"><span>REPORTAR</span> Episodio</a>
|
||||
<a href="#" class="BtnNw CVst BxSdw fa-eye" data-toggle="tooltip" title="Visto" data-seen="1"></a>
|
||||
<span class="BtnNw Clgt BxSdw lgtbx-lnk fa-lightbulb-o" data-toggle="tooltip" title="Apagar las luces"></span>
|
||||
<span class="BtnNw Xpnd BxSdw AAShwHdd-lnk" data-shwhdd="XpndCn"><i class="fa-expand" data-toggle="tooltip" title="Expandir"></i><i class="fa-compress" data-toggle="tooltip" title="Comprimir"></i></span>
|
||||
<span class="BtnNw Dwnd BxSdw fa-download AAShwHdd-lnk" data-shwhdd="DwsldCn"><span>DESCARGAR</span> Episodio</span>
|
||||
</div>
|
||||
<div class="WdgtCn DwsldCn" id="DwsldCn">
|
||||
<div class="DwsldCnTbl">
|
||||
<table class="RTbl Dwnl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>SERVIDOR</th>
|
||||
<th>TAMAÑO</th>
|
||||
<th>FORMATO</th>
|
||||
<th>DESCARGAR</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Stape</td><td><strong>MP4</strong></td><td>SUB</td><td><a target="_blank" rel="nofollow" href="https://streamtape.com/v/GAzj2z7R6kC1gJJ/" class="Button Sm fa-download">DESCARGAR</a></td></tr><tr><td>Zippyshare</td><td><strong>MP4</strong></td><td>SUB</td><td><a target="_blank" rel="nofollow" href="https://www39.zippyshare.com/v/vZcGS9L6/file.html" class="Button Sm fa-download">DESCARGAR</a></td></tr> </tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ShrCnB fa-share-alt">
|
||||
<div class="Title">COMPARTIR</div>
|
||||
<p>Ayuda a la web dandole like a nuestras redes sociales</p>
|
||||
<div style="position: absolute; right: 0;top: 0px;">
|
||||
<div class="addthis_inline_share_toolbox"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="WdgtCn">
|
||||
<div class="Top">
|
||||
<div class="Title">Comentarios</div>
|
||||
</div>
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
|
||||
var disqus_config = function () {
|
||||
|
||||
this.page.url = 'https://www3.animeflv.net/ver/digimon-adventure-2020-30';
|
||||
|
||||
this.page.identifier = 'episode_57237';
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
(function() { // DON'T EDIT BELOW THIS LINE
|
||||
|
||||
var d = document, s = d.createElement('script');
|
||||
|
||||
s.src = 'https://https-animeflv-net.disqus.com/embed.js';
|
||||
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
|
||||
(d.head || d.body).appendChild(s);
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
</div>
|
||||
</div>
|
||||
<div class="CpCnC">
|
||||
<a href="https://www.facebook.com/AnimeFLV/" target="_blank"><img src="https://animeflv.net/assets/animeflv/img/facebook-animeflv-oficial.png" alt="Facebook FLV"></a>
|
||||
<br /><br />
|
||||
<a href="https://twitter.com/somoskudasai" target="_blank" rel="nofollow"><img src="https://animeflv.net/assets/animeflv/img/twitter-kudasai-oficial.png" alt="Twitter Kudasai"></a>
|
||||
<br /><br />
|
||||
<section class="WdgtCn">
|
||||
<div class="Top">
|
||||
<div class="Title">Noticias de Anime</div>
|
||||
</div>
|
||||
<ul class="ListNews" id="Kudasai">
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="Footer">
|
||||
<div class="Container">
|
||||
<div class="BX Row BFluid Sp20 NMb">
|
||||
<div><p><span>Anime Online</span> - Ningún vídeo se encuentra alojado en nuestros servidores.</p>
|
||||
<nav class="mnftxt">
|
||||
<a href="/condiciones-de-uso.html">Términos y Condiciones</a>
|
||||
<a href="/politica-de-privacidad.html">Política de Privacidad</a>
|
||||
<a href="/sobre-animeflv.html">Sobre AnimeFLV</a>
|
||||
</nav>
|
||||
</div>
|
||||
<ul class="ListSocial BFixed">
|
||||
<li><a href="https://www.facebook.com/AnimeFLV/" target="_blank" class="fa-facebook"></a></li>
|
||||
<li><a href="https://www.youtube.com/c/kudasai" target="_blank" class="fa-youtube"></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
<div class="modal fade" id="ReportModal" tabindex="-1" role="dialog" aria-labelledby="ReportModal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="Sect">
|
||||
<div class="Top fa-flag">Reportar <a href="#" class="close fa-times" data-dismiss="modal" aria-label="Close"></a></div>
|
||||
<div class="Bod" style="padding: 20px;" id="report_body">
|
||||
<div class="form-group">
|
||||
<label for="report_reason">Motivo:</label>
|
||||
<select class="form-control" id="report_reason">
|
||||
<option value="0">No Reproduce</option>
|
||||
<option value="1">Problemas de Audio</option>
|
||||
<option value="2">Problemas con Subtitulos</option>
|
||||
<option value="3">No es el episodio</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="report_comment">Explicanos el problema:</label>
|
||||
<textarea class="form-control" id="report_comment"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default" id="report_submit">Enviar Reporte</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>var is_user = false;</script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/animeflv/js/jquery.typewatch.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/animeflv/js/scrlbr.js"></script>
|
||||
<script type="text/javascript" src="/assets/animeflv/js/jquery.bxslider.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/animeflv/js/percircle.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/animeflv/js/funciones.js?v=1.1.20"></script>
|
||||
<script type="text/javascript" src="/assets/animeflv/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/animeflv/js/alertify.js"></script>
|
||||
<!--[if lt IE 9]><script type="text/javascript" src="/assets/animeflv/js/ie/css3mq.js"></script>
|
||||
<![endif]-->
|
||||
<!--[if lte IE 9]><script type="text/javascript" src="/assets/animeflv/js/ie/ie.js"></script>
|
||||
<![endif]-->
|
||||
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5c3ecfc670146b84" async="async"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var anime_id = 3297;
|
||||
|
||||
var episode_id = 57237;
|
||||
|
||||
var episode_number = 30;
|
||||
|
||||
|
||||
|
||||
var in_library = 0;
|
||||
|
||||
var latest_seen = 0;
|
||||
|
||||
|
||||
|
||||
var videos = {"SUB":[{"server":"gocdn","title":"GoCDN","allow_mobile":true,"code":"https:\/\/streamium.xyz\/gocdn.html#QmoyaEVscFUwbDJkeUtaSVhZVTFOY2g4WkJ5akErWEhnNXJDVmJXVmFVK29MU1NUc1hXSFIxT1lJMzJ6YzdueXgvbzFkeFNJTU1kQWJ6MGkxNlFkeDFpZDZ3R01reDlWYUlqaEVmZldWaVZFVzlOQ2pESlA2RHJ4MFdCNTVnczQ="},{"server":"fembed","title":"Fembed","allow_mobile":true,"code":"https:\/\/embedsito.com\/v\/dk125hxedd5-wk8"},{"server":"stape","title":"Stape","url":"https:\/\/streamtape.com\/v\/GAzj2z7R6kC1gJJ\/","allow_mobile":true,"code":"https:\/\/streamtape.com\/e\/GAzj2z7R6kC1gJJ\/"},{"server":"okru","title":"Okru","allow_mobile":true,"code":"https:\/\/ok.ru\/videoembed\/2707307432624"},{"server":"yu","title":"YourUpload","allow_mobile":true,"code":"https:\/\/www.yourupload.com\/embed\/L4h84cKYL5rh"},{"server":"maru","title":"Maru","allow_mobile":true,"code":"https:\/\/my.mail.ru\/video\/embed\/8995617145282897342#budyak.rus#9662"},{"server":"netu","title":"Netu","allow_mobile":true,"code":"https:\/\/hqq.tv\/player\/embed_player.php?vid=Q3d4NGYzNEk3czdTcFlocDIxT1R0QT09"}]};
|
||||
|
||||
// var videos = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
initEpisode();
|
||||
|
||||
|
||||
|
||||
$.getJSON("/kudasai.php", function( data ) {
|
||||
|
||||
var items = '';
|
||||
|
||||
$.each( data, function( key, val ) {
|
||||
|
||||
var pslug = 'https://somoskudasai.com/' + val.category.slug + '/' + val.slug + '/';
|
||||
|
||||
var cslug = 'https://somoskudasai.com/categoria/'+ val.category.slug +'/';
|
||||
|
||||
|
||||
|
||||
items += '<li><article class="NwBxCn"><a target="_blank" href="' + pslug + '"><figure><img src="' + val.image + '" alt=""><span>' + val.date + '</span></figure></a> <h3 class="Title"><a target="_blank" href="' + pslug + '">' + val.title + '</a></h3><a target="_blank" href="' + cslug + '" class="CatLnk">' + val.category.name + '</a></article></li>';
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#Kudasai').append(items);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
if( window.loadingAds === undefined ){
|
||||
|
||||
document.getElementById("fbcomb").innerHTML = '<img src="/imgs/adblock_fb.png" alt="Comentarios Bloqueados por Adblock">';
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var _qevents = _qevents || [];
|
||||
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
var elem = document.createElement('script');
|
||||
|
||||
elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
|
||||
|
||||
elem.async = true;
|
||||
|
||||
elem.type = "text/javascript";
|
||||
|
||||
var scpt = document.getElementsByTagName('script')[0];
|
||||
|
||||
scpt.parentNode.insertBefore(elem, scpt);
|
||||
|
||||
})();
|
||||
|
||||
|
||||
|
||||
_qevents.push({
|
||||
|
||||
qacct:"p--mN3UcHCw6ueQ"
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<noscript>
|
||||
|
||||
<div style="display:none;">
|
||||
|
||||
<img src="//pixel.quantserve.com/pixel/p--mN3UcHCw6ueQ.gif" border="0" height="1" width="1" alt="Quantcast"/>
|
||||
|
||||
</div>
|
||||
|
||||
</noscript>
|
||||
|
||||
<script id="dsq-count-scr" src="//https-animeflv-net.disqus.com/count.js" async></script>
|
||||
<script src="/js/detector.js?v=1.0.1"></script>
|
||||
</body>
|
||||
</html>
|
61
t/downloaders/gocdn.t
Normal file
61
t/downloaders/gocdn.t
Normal file
@ -0,0 +1,61 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use feature 'say';
|
||||
|
||||
use Test::Most tests => 2;
|
||||
use Test::MockObject;
|
||||
|
||||
use Peertube::DL::Downloaders;
|
||||
use JSON;
|
||||
|
||||
{
|
||||
# GIVEN
|
||||
my $ua = Test::MockObject->new;
|
||||
my $base_response = Test::MockObject->new;
|
||||
my $gocdn_response = Test::MockObject->new;
|
||||
my $animeflv_response_file = 't/downloaders/animeflv_example_response.html';
|
||||
my $animeflv_response_decoded;
|
||||
my $download_data;
|
||||
my $expected_download_data_url = 'https://example.com/anime_correct_url';
|
||||
|
||||
my $expected_download_data = { filename => 'animu-1.mp4', url => $expected_download_data_url };
|
||||
open my $fh, '<', $animeflv_response_file;
|
||||
$animeflv_response_decoded = join( '', <$fh> );
|
||||
close $fh;
|
||||
my $gocdn_url;
|
||||
|
||||
my $expected_gocdn_url =
|
||||
'https://streamium.xyz/gocdn.php?v=QmoyaEVscFUwbDJkeUtaSVhZVTFOY2g4WkJ5akErWEhnNXJDVmJXVmFVK29MU1NUc1hXSFIxT1lJMzJ6YzdueXgvbzFkeFNJTU1kQWJ6MGkxNlFkeDFpZDZ3R01reDlWYUlqaEVmZldWaVZFVzlOQ2pESlA2RHJ4MFdCNTVnczQ=';
|
||||
|
||||
$ua->mock(
|
||||
get => sub {
|
||||
my $self = shift;
|
||||
my $url = shift;
|
||||
$gocdn_url = $url;
|
||||
return $gocdn_response;
|
||||
}
|
||||
);
|
||||
|
||||
$base_response->mock(
|
||||
decoded_content => sub {
|
||||
return $animeflv_response_decoded;
|
||||
},
|
||||
base => sub {
|
||||
return 'https://animeflv.net/ver/animu-1';
|
||||
}
|
||||
);
|
||||
|
||||
$gocdn_response->mock(
|
||||
is_success => sub {
|
||||
1;
|
||||
},
|
||||
decoded_content => sub {
|
||||
JSON::encode_json( { file => $expected_download_data_url } );
|
||||
}
|
||||
);
|
||||
|
||||
$download_data = Peertube::DL::Downloaders::gocdn( $ua, $base_response );
|
||||
is $gocdn_url, $expected_gocdn_url, 'The url got from gocdn is correct.';
|
||||
is_deeply $download_data, $expected_download_data, 'The download data got is the expected one.';
|
||||
}
|
Loading…
Reference in New Issue
Block a user