wudysoft commited on
Commit
4a8acf9
·
verified ·
1 Parent(s): 8c5e164

Update app.js

Browse files
Files changed (1) hide show
  1. app.js +3 -3
app.js CHANGED
@@ -97,8 +97,8 @@ app.get('/ytdl', async (req, res) => {
97
  if (!id) {
98
  return res.status(400).send('Parameter "id" is required.');
99
  }
100
-
101
- const apiUrl = `https://api.allorigins.win/raw?url=https://ytdlp.online/stream?command=-j https://www.youtube.com/watch?v=${id}`;
102
 
103
  try {
104
  const browser = await chromium.launch({ headless: true });
@@ -106,7 +106,7 @@ app.get('/ytdl', async (req, res) => {
106
  userAgent: 'Mozilla/5.0 (Linux; Android 6.0; iris50) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Mobile Safari/537.36',
107
  });
108
  const page = await context.newPage();
109
- await page.goto(apiUrl, { waitUntil: 'load' });
110
  const rawText = await page.evaluate(() => document.body.innerText);
111
  await browser.close();
112
  res.send(rawText);
 
97
  if (!id) {
98
  return res.status(400).send('Parameter "id" is required.');
99
  }
100
+ const command = `https://www.youtube.com/watch?v=${id} -j`;
101
+ const apiUrl = `https://api.allorigins.win/raw?url=https://ytdlp.online/stream?command=${encodeURIComponent(command)}`;
102
 
103
  try {
104
  const browser = await chromium.launch({ headless: true });
 
106
  userAgent: 'Mozilla/5.0 (Linux; Android 6.0; iris50) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Mobile Safari/537.36',
107
  });
108
  const page = await context.newPage();
109
+ await page.goto(apiUrl);
110
  const rawText = await page.evaluate(() => document.body.innerText);
111
  await browser.close();
112
  res.send(rawText);