Update app.js
Browse files
app.js
CHANGED
|
@@ -158,13 +158,28 @@ app.get('/ytdl', async (req, res) => {
|
|
| 158 |
await browser.close();
|
| 159 |
|
| 160 |
// Memproses hasil teks
|
| 161 |
-
const processedData = rawText
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
| 166 |
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
res.json(processedData);
|
| 169 |
} catch (error) {
|
| 170 |
console.error(error);
|
|
|
|
| 158 |
await browser.close();
|
| 159 |
|
| 160 |
// Memproses hasil teks
|
| 161 |
+
const processedData = rawText;
|
| 162 |
+
res.json(processedData);
|
| 163 |
+
} catch (error) {
|
| 164 |
+
console.error(error);
|
| 165 |
+
res.status(500).send('Something went wrong while processing the request.');
|
| 166 |
+
}
|
| 167 |
+
});
|
| 168 |
|
| 169 |
+
app.get('/ace', async (req, res) => {
|
| 170 |
+
const id = req.query.id;
|
| 171 |
+
|
| 172 |
+
if (!id) {
|
| 173 |
+
return res.status(400).send('Parameter "id" is required.');
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
try {
|
| 177 |
+
|
| 178 |
+
const apiUrl = `https://www.acethinker.com/downloader/api/video_info.php?url=https://www.youtube.com/watch?v=${id}&israpid=1&ismp3=0`;
|
| 179 |
+
const response = await fetch(apiUrl);
|
| 180 |
+
if (!response.ok) throw new Error('AceThinker API request failed');
|
| 181 |
+
|
| 182 |
+
const processedData = await response.json();
|
| 183 |
res.json(processedData);
|
| 184 |
} catch (error) {
|
| 185 |
console.error(error);
|