diff --git a/lib/Peertube/DL/Downloaders.pm b/lib/Peertube/DL/Downloaders.pm index 6011805..40a8b83 100644 --- a/lib/Peertube/DL/Downloaders.pm +++ b/lib/Peertube/DL/Downloaders.pm @@ -115,7 +115,7 @@ sub youtube { ), ( ( defined $_->{qualityLabel} ) - ? ( qualityLabel => $_->{qualityLabel} =~ s/p$//r ) + ? ( qualityLabel => $_->{qualityLabel} =~ s/p.*$//r ) : () ), ( @@ -139,8 +139,8 @@ sub youtube { ); my $video_formats = [ sort { - $b->{qualityLabel} <=> $a->{qualityLabel} - || $b->{bitrate} <=> $a->{bitrate} + $b->{qualityLabel} <=> $a->{qualityLabel} + || ( $b->{bitrate} // 0 ) <=> ( $a->{bitrate} // 0 ) } grep { defined $_->{qualityLabel} } @formats ]; my $audio_formats = [ diff --git a/lib/Peertube/DL/public/js/peertube-dl-web.js b/lib/Peertube/DL/public/js/peertube-dl-web.js index 42b5dad..a66965a 100644 --- a/lib/Peertube/DL/public/js/peertube-dl-web.js +++ b/lib/Peertube/DL/public/js/peertube-dl-web.js @@ -117,7 +117,7 @@ function downloadFormHandler(event) { async function generateBlobVideo(url) { const blob = await fetch(url, { - mode: 'cors', + mode: 'nocors', }) .then(res => res.blob()) .catch( err => generateBlobVideoByProxy(url) );