summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilien Devos <contact@emiliendevos.be>2020-05-22 20:35:22 +0200
committerEmilien Devos <contact@emiliendevos.be>2020-05-22 20:35:22 +0200
commit921ceaa124defa200f0d16ffcc1e57553213c17d (patch)
tree91261a26717b739318936f796dcf0791d1e801c9
parentf830dfcf15d23e63979aadab6e094e92719e29fe (diff)
avoid waiting for external resources
-rw-r--r--index.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/index.js b/index.js
index 75fe2ec..90123ac 100644
--- a/index.js
+++ b/index.js
@@ -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();
}