mix-id 1.0.1 → 1.0.3
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/cli.mjs +4 -4
- package/lib/audio.mjs +3 -4
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -65,6 +65,10 @@ if (!input || flags.help) {
|
|
|
65
65
|
process.exit(input ? 0 : 1);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// --- Resolve input type ---
|
|
69
|
+
|
|
70
|
+
const isURL = /^https?:\/\//i.test(input);
|
|
71
|
+
|
|
68
72
|
// --- Preflight checks ---
|
|
69
73
|
|
|
70
74
|
async function ensureDeps() {
|
|
@@ -97,10 +101,6 @@ async function ensureDeps() {
|
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
await ensureDeps();
|
|
100
|
-
|
|
101
|
-
// --- Resolve input ---
|
|
102
|
-
|
|
103
|
-
const isURL = /^https?:\/\//i.test(input);
|
|
104
104
|
let file;
|
|
105
105
|
|
|
106
106
|
if (isURL) {
|
package/lib/audio.mjs
CHANGED
|
@@ -58,11 +58,11 @@ export function downloadURL(url, outputDir) {
|
|
|
58
58
|
|
|
59
59
|
const dl = spawnSync('yt-dlp', [
|
|
60
60
|
'-x', '--audio-format', 'mp3', '--audio-quality', '0',
|
|
61
|
-
'-o', outTemplate, '--no-playlist', '--progress', url,
|
|
61
|
+
'-o', outTemplate, '--no-playlist', '--progress', '--newline', url,
|
|
62
62
|
], {
|
|
63
63
|
encoding: 'utf8',
|
|
64
64
|
timeout: 600_000,
|
|
65
|
-
stdio: ['pipe', '
|
|
65
|
+
stdio: ['pipe', 'inherit', 'inherit'],
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
// Find the output file
|
|
@@ -74,8 +74,7 @@ export function downloadURL(url, outputDir) {
|
|
|
74
74
|
if (existsSync(alt)) return alt;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
throw new Error(`Download failed:\n${errMsg}`);
|
|
77
|
+
throw new Error('Download failed. Check the URL and try again.');
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
/** Format file size for display. */
|