Added better extension support on youtube.

This commit is contained in:
sergiotarxz 2021-01-10 00:03:21 +01:00
parent bc52ffc855
commit 840f022b84
Signed by: sergiotarxz
GPG Key ID: E5903508B6510AC2
2 changed files with 12 additions and 20 deletions

View File

@ -18,29 +18,24 @@ youtube.com (Video only in webpage, all formats on cli.)
## Installation
There is two alternative ways applying to the GNU/Linux OS:
### System install
```shell
# Be aware the apt command applies to Debian/Ubuntu or other distributions using apt as their package manager.
# I am not adding instructions to every distro since they can difficult reading this document.
# You should use the equivalent packages for your distribution if you are not using a Debian-like distribution of GNU/Linux.
sudo apt install perl make libwww-perl liburi-encode-perl libjson-perl liblwp-protocol-https-perl libtest-mockobject-perl libtest-most-perl libmojolicious-perl
perl Makefile.PL
make
make test
make install
```
### Localized install with cpanminus.
```
sudo apt install cpanminus
sudo apt install cpanminus ducktape-dev
cpanm . --installdeps
cpanm .
```
### System install.
This requires you must seek for the dependencies yourself. (The contents from cpanfile + duktape-dev + ExtUtils::MakeMaker and then run:
```
perl Makefile.PL
make
sudo make install
```
### Windows
You should use Cywgin, Strawberry perl or WSL to be able to use this software in Windows

View File

@ -1,4 +1,3 @@
## Please see file perltidy.ERR
package Peertube::DL::Downloaders;
use strict;
@ -12,7 +11,6 @@ use File::Basename;
use JSON;
use Data::Dumper;
use Mojo::DOM;
use File::MimeInfo;
use Peertube::DL::Javascript;
use Peertube::DL::Utils;
@ -96,8 +94,7 @@ sub youtube {
say Data::Dumper::Dumper $format;
my $mime_type = $format->{mimeType} =~ s/;.*$//r;
say $mime_type;
my $extension = scalar File::MimeInfo::extensions($mime_type);
$extension = 'mp4' if $mime_type eq 'video/mp4';
my $extension = $mime_type =~ s/^.*?\///r =~ s/;.*$//r;
say $url;
return {
url => $url,