File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ function batchDownload(inputFile) {
279
279
280
280
outStream
281
281
. on ( 'finish' , ( ) => {
282
- console . log ( `\n [DONE] Written successfully.\n` ) ;
282
+ console . log ( `[DONE] Written successfully.\n` ) ;
283
283
downloadFiles . push ( outFile ) ;
284
284
285
285
// Return all downloaded audio files
@@ -305,5 +305,13 @@ function batchDownload(inputFile) {
305
305
}
306
306
307
307
if ( require . main === module ) {
308
- batchDownload ( argumentParser ( process . argv . slice ( 2 ) ) ) ;
308
+ let input = argumentParser ( process . argv . slice ( 2 ) ) ;
309
+ try {
310
+ // This will throw URIError if the input URL are invalid
311
+ input = ( new URL ( input ) ) . href ; // Simple URL validation
312
+ console . log ( '[INFO] URL input detected!' ) ;
313
+ singleDownload ( input ) ;
314
+ } catch ( error ) {
315
+ batchDownload ( input ) ;
316
+ }
309
317
}
You can’t perform that action at this time.
0 commit comments