diff options
author | Emilien Devos <contact@emiliendevos.be> | 2020-05-22 20:35:22 +0200 |
---|---|---|
committer | Emilien Devos <contact@emiliendevos.be> | 2020-05-22 20:35:22 +0200 |
commit | 921ceaa124defa200f0d16ffcc1e57553213c17d (patch) | |
tree | 91261a26717b739318936f796dcf0791d1e801c9 | |
parent | f830dfcf15d23e63979aadab6e094e92719e29fe (diff) |
avoid waiting for external resources
-rw-r--r-- | index.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -15,9 +15,9 @@ const app = new Koa(); app.use(async ctx => { if (ctx.query.url) { const page = await browser.newPage(); - await page.goto(ctx.query.url); + await page.goto(ctx.query.url, {timeout: 30000, waitUntil: 'domcontentloaded'}); if ((await page.content()).includes("cf-browser-verification")) - await page.waitForNavigation(); + await page.waitForNavigation({timeout: 30000, waitUntil: 'domcontentloaded'}); ctx.body = await page.content(); await page.close(); } |