A simple HTTP service that uses Puppeteer to capture screenshots of websites and return them as binary PNG data.
Setup
Set the browserless environment variable with your Browserless.io token
The service will be available as an HTTP endpoint
Usage
Make a GET request to the service with a url parameter:
GET /?url=https://example.com
Parameters
url (required): The URL of the website to screenshot
Response
Success: Returns a PNG image as binary data with Content-Type: image/png
Error: Returns error message as plain text with appropriate HTTP status code
Examples
# Take a screenshot of Wikipedia
curl "https://your-val-url.web.val.run/?url=https://en.wikipedia.org/wiki/OpenAI" -o screenshot.png
# Take a screenshot of Google
curl "https://your-val-url.web.val.run/?url=https://google.com" -o google.png
Features
Validates URL format before processing
Sets consistent viewport size (1280x720) for screenshots
Waits for network to be idle before taking screenshot
Returns proper error messages for invalid requests
Includes timeout protection (30 seconds)
Error Handling
The service handles various error cases:
Missing URL parameter (400)
Invalid URL format (400)
Missing browserless token (500)
Screenshot capture errors (500)
Configuration
Viewport: 1280x720 pixels
Screenshot type: PNG
Full page: Disabled (captures viewport only)
Timeout: 30 seconds
Wait condition: Network idle (no requests for 500ms)