ilhamdev commited on
Commit
e1bc497
·
verified ·
1 Parent(s): fa20a29

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +3 -4
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 output = await youtubedel(url, {
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
- const info = JSON.parse(output);
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 = {