-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69fe57e
commit bebc2b6
Showing
6 changed files
with
294 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Puppeteer as a Service | ||
|
||
## Getting Started | ||
|
||
```bash | ||
# Step 1: start browserless chrome | ||
docker run -d -p 3000:3000 --name browserless whatwewant/browserless-chrome:v1-0 | ||
|
||
# Step 2: start puppeteer service | ||
docker run -d -p 8080:8080 --name puppeteer-as-a-service \ | ||
-e BROWSER_WS_ENDPOINT=ws://browserless:3000 \ | ||
whatwewant/puppeteer:latest | ||
``` | ||
|
||
## Usage | ||
|
||
### 1. Generate PDF | ||
* Params | ||
* url: The URL to site url | ||
* required: true | ||
* format: The format of the outputted PDF | ||
* required: false | ||
* default: A4 | ||
|
||
```bash | ||
curl -X POST \ | ||
http://localhost:8887/pdf \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"url": "https://www.baidu.com", | ||
"options": { | ||
"format": "A4", | ||
"landscape": true | ||
} | ||
}' | ||
``` | ||
|
||
### 2. Generate Screenshot (Image) | ||
* Params | ||
* url: The URL to site url | ||
* required: true | ||
* fullPage: When true, takes a screenshot of the full scrollable page | ||
* required: false | ||
* default: true | ||
* encoding: The encoding of the image, can be either base64 or undefined | ||
* required: false | ||
* default: none | ||
* available: base64 | undefined | ||
* width: The width of the image | ||
* required: false | ||
* height: The height of the image | ||
* required: false | ||
|
||
```bash | ||
curl -X POST \ | ||
http://localhost:8080/image \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"url": "https://www.baidu.com" | ||
}' | ||
``` | ||
|
||
## License | ||
* MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
services: | ||
app: | ||
build: . | ||
puppeteer: | ||
# build: . | ||
image: whatwewant/puppeteer:latest | ||
ports: | ||
- 18080:8080 | ||
environment: | ||
BROWSER_WS_ENDPOINT: wss://chrome.browserless.io | ||
BROWSER_WS_ENDPOINT: ws://browserless:3000 | ||
|
||
browserless: | ||
image: whatwewant/browserless-chrome:v1-0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.