mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
Merge pull request #118 from th-ch/dl-custom-audio-format
Downloader plugin - custom audio format
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "youtube-music",
|
||||
"productName": "YouTube Music",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "YouTube Music Desktop App - including custom plugins",
|
||||
"license": "MIT",
|
||||
"repository": "th-ch/youtube-music",
|
||||
|
||||
@ -73,6 +73,7 @@ const toMP3 = async (
|
||||
options
|
||||
) => {
|
||||
const safeVideoName = randomBytes(32).toString("hex");
|
||||
const extension = options.extension || "mp3";
|
||||
|
||||
try {
|
||||
if (!ffmpeg.isLoaded()) {
|
||||
@ -87,15 +88,17 @@ const toMP3 = async (
|
||||
await ffmpeg.run(
|
||||
"-i",
|
||||
safeVideoName,
|
||||
...options.ffmpegArgs,
|
||||
safeVideoName + ".mp3"
|
||||
...(options.ffmpegArgs || []),
|
||||
safeVideoName + "." + extension
|
||||
);
|
||||
|
||||
const folder = options.downloadFolder || downloadsFolder();
|
||||
const filename = filenamify(videoName + ".mp3", { replacement: "_" });
|
||||
const filename = filenamify(videoName + "." + extension, {
|
||||
replacement: "_",
|
||||
});
|
||||
writeFileSync(
|
||||
join(folder, filename),
|
||||
ffmpeg.FS("readFile", safeVideoName + ".mp3")
|
||||
ffmpeg.FS("readFile", safeVideoName + "." + extension)
|
||||
);
|
||||
|
||||
reinit();
|
||||
|
||||
Reference in New Issue
Block a user