#!/usr/bin/env perl use feature 'say'; use strict; use warnings; use Peertube::DL::URLHandler; die "No url passed" unless @ARGV; 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); 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;