Spaces:
Sleeping
Sleeping
Update kontol.js
Browse files
kontol.js
CHANGED
|
@@ -21,10 +21,10 @@ app.get('/scrape', async (req, res) => {
|
|
| 21 |
await page.goto(url, { waitUntil: 'load', timeout: 60000 });
|
| 22 |
await page.waitForSelector('body');
|
| 23 |
|
| 24 |
-
const
|
| 25 |
await browser.close();
|
| 26 |
|
| 27 |
-
res.
|
| 28 |
} catch (error) {
|
| 29 |
res.status(500).json({ error: 'Failed to scrape the website', details: error.message });
|
| 30 |
}
|
|
|
|
| 21 |
await page.goto(url, { waitUntil: 'load', timeout: 60000 });
|
| 22 |
await page.waitForSelector('body');
|
| 23 |
|
| 24 |
+
const html = await page.content();
|
| 25 |
await browser.close();
|
| 26 |
|
| 27 |
+
res.status(200).send(html);
|
| 28 |
} catch (error) {
|
| 29 |
res.status(500).json({ error: 'Failed to scrape the website', details: error.message });
|
| 30 |
}
|