media-dl 2.1.4 → 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 +13 -6
- 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}`);
|
|
@@ -559,13 +560,19 @@ async function systemMaintenance() {
|
|
|
559
560
|
// --- ENTRY POINT ---
|
|
560
561
|
async function bootstrap() {
|
|
561
562
|
const status = checkTools();
|
|
562
|
-
|
|
563
563
|
if (!status.allReady) {
|
|
564
|
-
// Jika ada yang kurang, masuk ke mode instalasi
|
|
565
564
|
await firstTimeSetup();
|
|
566
565
|
} else {
|
|
567
|
-
//
|
|
568
|
-
|
|
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
|
+
}
|
|
569
576
|
}
|
|
570
577
|
}
|
|
571
578
|
|