Update index.js
Browse files
index.js
CHANGED
|
@@ -276,15 +276,15 @@ function formatSize(bytes, si = false, dp = 2) {
|
|
| 276 |
return `${bytes.toFixed(dp)} ${units[u]}`;
|
| 277 |
}
|
| 278 |
|
| 279 |
-
async function ytmp4(url, quality = '
|
| 280 |
try {
|
| 281 |
const ID = ytdl.getVideoID(url),
|
| 282 |
data = await ytdl.getInfo('https://www.youtube.com/watch?v=' + ID);
|
| 283 |
-
const videoStream = await ytdl(ID, { filter:
|
| 284 |
let buffer = await streamToBuffer(videoStream);
|
| 285 |
let upload = await uploadBuffer(buffer);
|
| 286 |
let urel = upload != null ? { url_v2: upload } : null;
|
| 287 |
-
let format = ytdl.chooseFormat(data.formats, { filter:
|
| 288 |
|
| 289 |
if (format) {
|
| 290 |
return {
|
|
@@ -309,7 +309,7 @@ async function ytmp4(url, quality = 'highestvideo') {
|
|
| 309 |
}
|
| 310 |
}
|
| 311 |
|
| 312 |
-
async function ytmp3(url, bitrate = '
|
| 313 |
try {
|
| 314 |
const ID = ytdl.getVideoID(url),
|
| 315 |
data = await ytdl.getInfo('https://www.youtube.com/watch?v=' + ID);
|
|
@@ -385,6 +385,7 @@ async function ytmp3(url, bitrate = 'lowestaudio') {
|
|
| 385 |
}
|
| 386 |
}
|
| 387 |
|
|
|
|
| 388 |
// Fungsi untuk mengkonversi video dari YouTube
|
| 389 |
const convert = async (url, v_id, ftype, fquality, fname, token, timeExpire) => {
|
| 390 |
let params = {
|
|
|
|
| 276 |
return `${bytes.toFixed(dp)} ${units[u]}`;
|
| 277 |
}
|
| 278 |
|
| 279 |
+
async function ytmp4(url, quality = 'highest') {
|
| 280 |
try {
|
| 281 |
const ID = ytdl.getVideoID(url),
|
| 282 |
data = await ytdl.getInfo('https://www.youtube.com/watch?v=' + ID);
|
| 283 |
+
const videoStream = await ytdl(ID, { filter: format => format.hasVideo && format.hasAudio, quality: quality });
|
| 284 |
let buffer = await streamToBuffer(videoStream);
|
| 285 |
let upload = await uploadBuffer(buffer);
|
| 286 |
let urel = upload != null ? { url_v2: upload } : null;
|
| 287 |
+
let format = ytdl.chooseFormat(data.formats, { filter: format => format.hasVideo && format.hasAudio, quality: quality });
|
| 288 |
|
| 289 |
if (format) {
|
| 290 |
return {
|
|
|
|
| 309 |
}
|
| 310 |
}
|
| 311 |
|
| 312 |
+
async function ytmp3(url, bitrate = 'lowest') {
|
| 313 |
try {
|
| 314 |
const ID = ytdl.getVideoID(url),
|
| 315 |
data = await ytdl.getInfo('https://www.youtube.com/watch?v=' + ID);
|
|
|
|
| 385 |
}
|
| 386 |
}
|
| 387 |
|
| 388 |
+
|
| 389 |
// Fungsi untuk mengkonversi video dari YouTube
|
| 390 |
const convert = async (url, v_id, ftype, fquality, fname, token, timeExpire) => {
|
| 391 |
let params = {
|