Update index.js
Browse files
index.js
CHANGED
|
@@ -200,7 +200,7 @@ const youtubedel = require('youtube-dl-exec');
|
|
| 200 |
async function ytAPI(url) {
|
| 201 |
try {
|
| 202 |
// Execute youtube-dl to get video information
|
| 203 |
-
const
|
| 204 |
dumpSingleJson: true,
|
| 205 |
noCheckCertificates: true,
|
| 206 |
noWarnings: true,
|
|
@@ -208,9 +208,7 @@ async function ytAPI(url) {
|
|
| 208 |
addHeader: ['referer:youtube.com', 'user-agent:googlebot']
|
| 209 |
});
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
// Extract necessary information
|
| 214 |
const videoDetails = {
|
| 215 |
title: info.title,
|
| 216 |
url: url,
|
|
@@ -241,6 +239,7 @@ async function ytAPI(url) {
|
|
| 241 |
}
|
| 242 |
|
| 243 |
|
|
|
|
| 244 |
// Fungsi untuk mengkonversi video dari YouTube
|
| 245 |
const convert = async (url, v_id, ftype, fquality, fname, token, timeExpire) => {
|
| 246 |
let params = {
|
|
|
|
| 200 |
async function ytAPI(url) {
|
| 201 |
try {
|
| 202 |
// Execute youtube-dl to get video information
|
| 203 |
+
const info = await youtubedel(url, {
|
| 204 |
dumpSingleJson: true,
|
| 205 |
noCheckCertificates: true,
|
| 206 |
noWarnings: true,
|
|
|
|
| 208 |
addHeader: ['referer:youtube.com', 'user-agent:googlebot']
|
| 209 |
});
|
| 210 |
|
| 211 |
+
// Directly use info, which should already be an object
|
|
|
|
|
|
|
| 212 |
const videoDetails = {
|
| 213 |
title: info.title,
|
| 214 |
url: url,
|
|
|
|
| 239 |
}
|
| 240 |
|
| 241 |
|
| 242 |
+
|
| 243 |
// Fungsi untuk mengkonversi video dari YouTube
|
| 244 |
const convert = async (url, v_id, ftype, fquality, fname, token, timeExpire) => {
|
| 245 |
let params = {
|