peertube-backup/peertube_backup.pl

35 lines
682 B
Perl

#! perl
use strict;
my $wget="c:/tools/wget/wget.exe";
my $transmisson="\"c:/Program Files/Transmission/transmission-remote.exe\"";
my $path="d:/peertube_backup";
system("$wget -nc https://cliptube.org/feeds/videos.atom?accountName=alexlehm -O videos.atom");
open(XML, "videos.atom");
while(<XML>) {
chop;
if(m@<link href="(.*/w/.*)"@) {
my $url=$1;
$url=~m@/w/(.*)@;
my $id=$1;
$url =~ s@/w/@/api/v1/videos/@;
system("$wget -nc $url");
my $torrent="";
open(FILE, $id);
while(<FILE>) {
if(m@"torrentDownloadUrl":"([^\"]*-1080.torrent)"@) {
$torrent=$1;
system("$transmisson -w $path -a $torrent");
}
}
close FILE;
}
}
close XML;