npmytd 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/package.json +1 -1
- package/src/cli.js +4 -4
- package/src/downloader.js +8 -8
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -28,11 +28,11 @@ async function main() {
|
|
|
28
28
|
|
|
29
29
|
await downloadYouTubeMedia(url, format, quality, outputPath);
|
|
30
30
|
|
|
31
|
-
console.log(chalk.bold.green(
|
|
32
|
-
Process completed successfully
|
|
31
|
+
console.log(chalk.bold.green(`
|
|
32
|
+
Process completed successfully!`));
|
|
33
33
|
} catch (error) {
|
|
34
|
-
console.error(chalk.red(
|
|
35
|
-
An error occurred
|
|
34
|
+
console.error(chalk.red(`
|
|
35
|
+
An error occurred:`), error.message);
|
|
36
36
|
process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/downloader.js
CHANGED
|
@@ -106,8 +106,8 @@ Download completed: ${finalPath}${outputExtension}`));
|
|
|
106
106
|
});
|
|
107
107
|
video.on('error', (err) => {
|
|
108
108
|
bar.stop();
|
|
109
|
-
console.error(chalk.red(
|
|
110
|
-
Error during download
|
|
109
|
+
console.error(chalk.red(`
|
|
110
|
+
Error during download:`, err.message));
|
|
111
111
|
reject(err);
|
|
112
112
|
});
|
|
113
113
|
});
|
|
@@ -130,8 +130,8 @@ Error during download:', err.message));
|
|
|
130
130
|
audioStream.pipe(fs.createWriteStream(tempFilePath))
|
|
131
131
|
.on('finish', () => {
|
|
132
132
|
bar.stop();
|
|
133
|
-
console.log(chalk.blue(
|
|
134
|
-
Download of audio stream completed. Starting conversion to MP3
|
|
133
|
+
console.log(chalk.blue(`
|
|
134
|
+
Download of audio stream completed. Starting conversion to MP3...`));
|
|
135
135
|
|
|
136
136
|
// Check if ffmpeg is available
|
|
137
137
|
ffmpeg.getFfmpegVersion((err) => {
|
|
@@ -158,16 +158,16 @@ Conversion and download completed: ${finalPath}${outputExtension}`));
|
|
|
158
158
|
fs.unlink(tempFilePath, (err) => { // Clean up temporary file on error
|
|
159
159
|
if (err) console.error(chalk.yellow('Warning: Could not remove temporary file:', err.message));
|
|
160
160
|
});
|
|
161
|
-
console.error(chalk.red(
|
|
162
|
-
Error during MP3 conversion
|
|
161
|
+
console.error(chalk.red(`
|
|
162
|
+
Error during MP3 conversion:`, err.message));
|
|
163
163
|
reject(err);
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
166
|
})
|
|
167
167
|
.on('error', (err) => {
|
|
168
168
|
bar.stop();
|
|
169
|
-
console.error(chalk.red(
|
|
170
|
-
Error during audio stream download
|
|
169
|
+
console.error(chalk.red(`
|
|
170
|
+
Error during audio stream download:`, err.message));
|
|
171
171
|
reject(err);
|
|
172
172
|
});
|
|
173
173
|
});
|