From 110846629e360e08ff6732ecdb0a326edd4b9533 Mon Sep 17 00:00:00 2001 From: kev Date: Thu, 6 Jun 2024 15:24:58 +0800 Subject: [PATCH] update browserless --- browserless/README.md | 43 ++++++++++++++++--------------- browserless/docker-compose-v2.yml | 2 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/browserless/README.md b/browserless/README.md index 6a28d55..ba7cd10 100644 --- a/browserless/README.md +++ b/browserless/README.md @@ -5,27 +5,6 @@ browserless way. It takes care of all the binaries and managing of Chrome so you don't have to. -## docker-compose.yml - -```yaml -version: '3.8' -services: - browserless: - image: browserless/chrome:1-chrome-stable - ports: - - "3000:3000" - environment: - - DEBUG=browserless/chrome - - MAX_CONCURRENT_SESSIONS=100 - - CONNECTION_TIMEOUT=300000 - - MAX_QUEUE_LENGTH=100 - - ENABLE_CORS=true - - ENABLE_DEBUG_VIEWER=true - - EXIT_ON_HEALTH_FAILURE=true - # TOKEN=4e2a9c32-2854-479a-a9f3-ba8899f2fdc1 - restart: unless-stopped -``` - ## screenshot.js ```javascript @@ -111,4 +90,26 @@ i.ytimg.com www.youtube.com ``` +## Waiting for Condition (v2) + +[async][2] functions are supported + +```bash +$ cat fn.js +async () => { + await new Promise(resolve => { + const interval = setInterval(() => { + var e = document.querySelector('#tryit-data'); + if (e && e.innerText.includes('country')) { + resolve(); + clearInterval(interval); + } + }, 1000) + }); +} + +$ http '127.0.0.1:3000/content?token=1234567890&stealth&--proxy-server=http://x.x.x.x:8080' url='https://ipinfo.io' waitForFunction[fn]=@fn.js waitForFunction[timeout]:=10000 > ipinfo.html +``` + [1]: https://docs.browserless.io/ +[2]: https://docs.browserless.io/HTTP-APIs/content#waitforfunction diff --git a/browserless/docker-compose-v2.yml b/browserless/docker-compose-v2.yml index 5581c82..ecb27be 100644 --- a/browserless/docker-compose-v2.yml +++ b/browserless/docker-compose-v2.yml @@ -5,7 +5,7 @@ version: "3.8" services: browserless: - image: ghcr.io/browserless/chromium:v2.12.0 + image: ghcr.io/browserless/chromium:v2.13.0 ports: - "3000:3000" environment: