Update app.js
Browse files
app.js
CHANGED
|
@@ -192,14 +192,7 @@ app.get('/ytdl/v2', async (req, res) => {
|
|
| 192 |
|
| 193 |
if (!lastLine) return res.status(404).json({ error: 'No valid data found.' });
|
| 194 |
|
| 195 |
-
|
| 196 |
-
const downloadLink = $('a[href]')
|
| 197 |
-
.filter((_, el) => $(el).text().includes('download'))
|
| 198 |
-
.attr('href');
|
| 199 |
-
|
| 200 |
-
if (!downloadLink) return res.status(404).json({ error: 'No download link found.' });
|
| 201 |
-
|
| 202 |
-
res.json({ downloadLink: downloadLink.startsWith('/') ? `https://ytdlp.online${downloadLink}` : downloadLink });
|
| 203 |
} catch (error) {
|
| 204 |
console.error(error);
|
| 205 |
res.status(500).json({ error: 'Something went wrong while processing the request.' });
|
|
|
|
| 192 |
|
| 193 |
if (!lastLine) return res.status(404).json({ error: 'No valid data found.' });
|
| 194 |
|
| 195 |
+
res.json({ data: lastLine });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
} catch (error) {
|
| 197 |
console.error(error);
|
| 198 |
res.status(500).json({ error: 'Something went wrong while processing the request.' });
|