Update index.js
Browse files
index.js
CHANGED
|
@@ -372,6 +372,33 @@ async function convertToAudio(buffer, ext) {
|
|
| 372 |
console.error(e);
|
| 373 |
throw e;
|
| 374 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
}*/
|
| 376 |
|
| 377 |
async function ytmp4(url, quality = 'highestvideo') {
|
|
@@ -432,33 +459,6 @@ async function ytmp3(url, bitrate = 'highestaudio') {
|
|
| 432 |
}
|
| 433 |
}
|
| 434 |
|
| 435 |
-
//let konver = await convertToAudio(buffer, "mp4");
|
| 436 |
-
//let upload = await uploadBuffer(konver);
|
| 437 |
-
//let urel = upload != null ? { url_v2: upload } : null;
|
| 438 |
-
let format = ytdl.chooseFormat(data.formats, { filter: 'audioonly', quality: bitrate });
|
| 439 |
-
|
| 440 |
-
if (format) {
|
| 441 |
-
return {
|
| 442 |
-
title: data.videoDetails.title,
|
| 443 |
-
description: data.videoDetails.description,
|
| 444 |
-
channel: data.videoDetails.ownerChannelName,
|
| 445 |
-
views: formatViews(data.videoDetails.viewCount),
|
| 446 |
-
publish: data.videoDetails.publishDate,
|
| 447 |
-
duration: formatDuration(data.videoDetails.lengthSeconds),
|
| 448 |
-
size: format.contentLength ? formatSize(format.contentLength) : 0,
|
| 449 |
-
quality: format.audioQuality,
|
| 450 |
-
thumb: data.videoDetails.thumbnails[0].url,
|
| 451 |
-
dl_url: format.url,
|
| 452 |
-
//...urel,
|
| 453 |
-
};
|
| 454 |
-
} else {
|
| 455 |
-
throw new Error('No suitable format found');
|
| 456 |
-
}
|
| 457 |
-
} catch (error) {
|
| 458 |
-
console.error('Error occurred:', error);
|
| 459 |
-
return error;
|
| 460 |
-
}
|
| 461 |
-
}
|
| 462 |
|
| 463 |
// Fungsi untuk mengkonversi video dari YouTube
|
| 464 |
const convert = async (url, v_id, ftype, fquality, fname, token, timeExpire) => {
|
|
|
|
| 372 |
console.error(e);
|
| 373 |
throw e;
|
| 374 |
}
|
| 375 |
+
}
|
| 376 |
+
//let konver = await convertToAudio(buffer, "mp4");
|
| 377 |
+
//let upload = await uploadBuffer(konver);
|
| 378 |
+
//let urel = upload != null ? { url_v2: upload } : null;
|
| 379 |
+
let format = ytdl.chooseFormat(data.formats, { filter: 'audioonly', quality: bitrate });
|
| 380 |
+
|
| 381 |
+
if (format) {
|
| 382 |
+
return {
|
| 383 |
+
title: data.videoDetails.title,
|
| 384 |
+
description: data.videoDetails.description,
|
| 385 |
+
channel: data.videoDetails.ownerChannelName,
|
| 386 |
+
views: formatViews(data.videoDetails.viewCount),
|
| 387 |
+
publish: data.videoDetails.publishDate,
|
| 388 |
+
duration: formatDuration(data.videoDetails.lengthSeconds),
|
| 389 |
+
size: format.contentLength ? formatSize(format.contentLength) : 0,
|
| 390 |
+
quality: format.audioQuality,
|
| 391 |
+
thumb: data.videoDetails.thumbnails[0].url,
|
| 392 |
+
dl_url: format.url,
|
| 393 |
+
//...urel,
|
| 394 |
+
};
|
| 395 |
+
} else {
|
| 396 |
+
throw new Error('No suitable format found');
|
| 397 |
+
}
|
| 398 |
+
} catch (error) {
|
| 399 |
+
console.error('Error occurred:', error);
|
| 400 |
+
return error;
|
| 401 |
+
}
|
| 402 |
}*/
|
| 403 |
|
| 404 |
async function ytmp4(url, quality = 'highestvideo') {
|
|
|
|
| 459 |
}
|
| 460 |
}
|
| 461 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
|
| 463 |
// Fungsi untuk mengkonversi video dari YouTube
|
| 464 |
const convert = async (url, v_id, ftype, fquality, fname, token, timeExpire) => {
|