media-dl 2.1.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +17 -8
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -123,7 +123,7 @@ function runSpawn(command, args) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
// --- DOWNLOAD ENGINE ---
|
|
126
|
-
async function startDownload() {
|
|
126
|
+
async function startDownload(videoURLFromArgs = null) {
|
|
127
127
|
let { ytExists, ffExists } = checkTools();
|
|
128
128
|
if (!ytExists) {
|
|
129
129
|
console.log(
|
|
@@ -141,7 +141,8 @@ async function startDownload() {
|
|
|
141
141
|
if (cont.toLowerCase() !== 'y') return mainMenu();
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
const videoURL =
|
|
144
|
+
const videoURL =
|
|
145
|
+
videoURLFromArgs || (await askQuestion('Masukkan Link (Video/Playlist): '));
|
|
145
146
|
if (!videoURL) return mainMenu();
|
|
146
147
|
|
|
147
148
|
console.log(`${C.dim}⏳ Menganalisa tautan...${C.reset}`);
|
|
@@ -241,8 +242,8 @@ async function startDownload() {
|
|
|
241
242
|
console.log(
|
|
242
243
|
`${C.red}❌ Error: Anda wajib menginstal FFmpeg untuk mengunduh audio.${C.reset}`
|
|
243
244
|
);
|
|
244
|
-
await askQuestion('
|
|
245
|
-
|
|
245
|
+
await askQuestion('Tekan Enter untuk kembali ke Menu Utama...');
|
|
246
|
+
mainMenu();
|
|
246
247
|
}
|
|
247
248
|
args.unshift('-x', '--audio-format', 'mp3');
|
|
248
249
|
} else {
|
|
@@ -274,6 +275,8 @@ async function startDownload() {
|
|
|
274
275
|
} else {
|
|
275
276
|
console.log(`\n${C.red}❌ Terjadi kesalahan saat mengunduh.${C.reset}`);
|
|
276
277
|
}
|
|
278
|
+
await askQuestion('Tekan Enter untuk kembali ke Menu Utama...');
|
|
279
|
+
mainMenu();
|
|
277
280
|
}
|
|
278
281
|
|
|
279
282
|
async function showSupport() {
|
|
@@ -557,13 +560,19 @@ async function systemMaintenance() {
|
|
|
557
560
|
// --- ENTRY POINT ---
|
|
558
561
|
async function bootstrap() {
|
|
559
562
|
const status = checkTools();
|
|
560
|
-
|
|
561
563
|
if (!status.allReady) {
|
|
562
|
-
// Jika ada yang kurang, masuk ke mode instalasi
|
|
563
564
|
await firstTimeSetup();
|
|
564
565
|
} else {
|
|
565
|
-
//
|
|
566
|
-
|
|
566
|
+
// process.argv[2] mengambil argumen pertama setelah nama perintah
|
|
567
|
+
const urlArgument = process.argv[2];
|
|
568
|
+
|
|
569
|
+
if (urlArgument) {
|
|
570
|
+
// Jika ada URL di terminal, langsung jalankan download
|
|
571
|
+
await startDownload(urlArgument);
|
|
572
|
+
} else {
|
|
573
|
+
// Jika tidak ada, masuk ke menu utama seperti biasa [cite: 113]
|
|
574
|
+
mainMenu();
|
|
575
|
+
}
|
|
567
576
|
}
|
|
568
577
|
}
|
|
569
578
|
|