Update app.js
Browse files
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
|
| 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
|
| 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);
|