@ -69,6 +69,7 @@ let foldernameFormat = "%(playlist_title)s";
let filenameFormat = "%(playlist_index)s.%(title)s.%(ext)s" ;
let playlistIndex = 1 ;
let playlistEnd = "" ;
let proxy = ""
/ * *
*
@ -113,6 +114,9 @@ function download(type) {
configArg = "--config-location" ;
configTxt = ` " ${ localStorage . getItem ( "configPath" ) } " ` ;
}
proxy = localStorage . getItem ( "proxy" ) || "" ;
console . log ( "Proxy:" , proxy )
nameFormatting ( ) ;
originalCount = 0 ;
@ -174,8 +178,7 @@ function download(type) {
const controller = new AbortController ( ) ;
if ( type === "video" ) {
downloadProcess = ytdlp . exec (
[
const args = [
format ,
"--yes-playlist" ,
"-o" ,
@ -192,8 +195,14 @@ function download(type) {
subs ,
subLangs ,
videoType == "mp4" ? "--embed-thumbnail" : "" ,
proxy ? "--no-check-certificate" : "" ,
proxy ? "--proxy" : "" ,
proxy ,
` " ${ url } " ` ,
] ,
] . filter ( item => item ) ;
downloadProcess = ytdlp . exec (
args ,
{ shell : true , detached : false } ,
controller . signal
) ;
@ -205,8 +214,8 @@ function download(type) {
audioQuality === "auto"
) {
console . log ( "Downloading m4a without extracting" )
downloadProcess = ytdlp . exec (
[
const args = [
"--yes-playlist" ,
"--no-warnings" ,
"-f" ,
@ -229,15 +238,21 @@ function download(type) {
subs ,
subLangs ,
"--embed-thumbnail" ,
proxy ? "--no-check-certificate" : "" ,
proxy ? "--proxy" : "" ,
proxy ,
` " ${ url } " ` ,
] ,
] . filter ( item => item ) ;
downloadProcess = ytdlp . exec (
args ,
{ shell : true , detached : false } ,
controller . signal
) ;
} else {
console . log ( "Extracting audio" )
downloadProcess = ytdlp . exec (
[
const args = [
"--yes-playlist" ,
"--no-warnings" ,
"-x" ,
@ -263,15 +278,21 @@ function download(type) {
subs ,
subLangs ,
format === "mp3" || format === "m4a" ? "--embed-thumbnail" : "" ,
proxy ? "--no-check-certificate" : "" ,
proxy ? "--proxy" : "" ,
proxy ,
` " ${ url } " ` ,
] ,
] . filter ( item => item ) ;
downloadProcess = ytdlp . exec (
args ,
{ shell : true , detached : false } ,
controller . signal
) ;
}
}
downloadProcess . on ( "ytDlpEvent" , ( eventType, eventData ) => {
downloadProcess . on ( "ytDlpEvent" , ( _ eventType, eventData ) => {
// console.log(eventData);
if ( eventData . includes ( playlistTxt ) ) {
@ -409,8 +430,8 @@ function downloadThumbnails() {
hideOptions ( ) ;
nameFormatting ( ) ;
managePlaylistRange ( ) ;
const downloadProcess = ytdlp . exec (
[
const args = [
"--yes-playlist" ,
"--no-warnings" ,
"-o" ,
@ -424,8 +445,14 @@ function downloadThumbnails() {
` " ${ playlistIndex } : ${ playlistEnd } " ` ,
"--ffmpeg-location" ,
ffmpeg ,
proxy ? "--no-check-certificate" : "" ,
"--proxy" ,
proxy ,
` " ${ url } " ` ,
] ,
] . filter ( item => item ) ;
const downloadProcess = ytdlp . exec (
args ,
{ shell : true , detached : false }
) ;
@ -479,8 +506,8 @@ function saveLinks() {
hideOptions ( ) ;
nameFormatting ( ) ;
managePlaylistRange ( ) ;
const downloadProcess = ytdlp . exec (
[
const args = [
"--yes-playlist" ,
"--no-warnings" ,
cookieArg ,
@ -492,8 +519,14 @@ function saveLinks() {
"--skip-download" ,
"-I" ,
` " ${ playlistIndex } : ${ playlistEnd } " ` ,
proxy ? "--no-check-certificate" : "" ,
"--proxy" ,
proxy ,
` " ${ url } " ` ,
] ,
] . filter ( item => item ) ;
const downloadProcess = ytdlp . exec (
args ,
{ shell : true , detached : false }
) ;