background
in case this is the very first time you're hearing about puppeteer, i'd highly recommend googling what it does first and also refer to the official documentation to get a quick sense of what it's all about.
here's a video from the docs that should help you get started too —
intro
a couple days ago, i launched pptr.io with the purpose to deliver a free & open source api that runs puppeteer as a service — think of it a spin-off of the original pptraas.com (defunct) tool.
the entire service is powered by vercel — specifically, it's serverless functions offering.
as of this post, the api is able to deliver the following —
- capture a screenshot from a given url
- fetch metrics of a page
- get a timeline trace
- render page as a pdf
...more to be added soon 😉
i've ensured to keep the documentation as simple as possible and you can find all you need on that here —
table of contents
usage
- base url
- production:
https://pptr.io/
- preview (staging):
https://dev.pptr.io/
- production:
- default path:
api/
- endpoint: any one of the individual
.js
files in the api folder- ignore the
index.js
file inside theapi
folder
- ignore the
endpoints
screenshot
- task: takes a screenshot of the input url
- class: page.screenshot
- method:
GET
- api:
https://pptr.io/api/screenshot?url=https://dev.to
- source: screenshot.js
optional params | type | description | default |
---|---|---|---|
width |
number | width of the screenshot. | 1920 |
height |
number | height of the screenshot. | 1080 |
deviceScaleFactor |
number | device scale factor (can be thought of as DPR). | 1 |
fullPage |
boolean | when true , takes a screenshot of the full scrollable page. |
false |
type |
string | can be either jpeg , png or webp . |
png |
metrics
- task: fetch metrics of the page
- class: page.metrics
- …
contribute
i'm actively working to —
- partner with folks who'd want to add more methods to the api.
- check-in with the community on some feedback & inspiration on what new can be done.
discuss
feel free to reach out in case you have any cool problem statements that you'd like to see solved using this api —
Top comments (0)