Extract HTML
/snap
Instead of creating a screenshot, you can extract the fully rendered raw HTML from a web page using the snap endpoint and the html_only parameter.
Extract HTML functionality is optimized to fetch html content from websites and web applications that dynamically generate their HTML using JavaScript.
| Option | Expected Value |
|---|---|
| url | The URL to fetch HTML |
| access_token | Your account's Private API Key. |
| html_only | Pass html_only=true to retrieve the full HTML from the web page, instead of creating a screenshot of the web page. |
| selectors | (Optional) Instead of the full HTML, returns only the outerHTML associated with an element identified by a CSS Selector. |
Example: Get the full HTML for the entire page
The following example fetches the full raw HTML from the Mars Rover Perseverance's Wikipedia page:
/snap
http
https://api.pagepixels.com/snap?url=https://en.wikipedia.org/wiki/Perseverance_(rover)&access_token=your-api-key&html_only=true
{
"success": true,
"html": "\u003C!DOCTYPE html\u003E\u003Chtml..."
}
Example: Get only the HTML for a specified element
The example below fetches only the outerHTML for the table.infobox element from the Ring-tailed lemur's Wikipedia page:
/snap
bash
curl -X GET "https://api.pagepixels.com/snap" \
--data-urlencode "url=https://en.wikipedia.org/wiki/Ring-tailed_lemur" \
-d html_only=true \
--data-urlencode "selectors=table.infobox" \
-d access_token="your-api-key"
{
"success": true,
"html": "\u003ctable class=\"infobox biota\"..."
}
Support
Questions? Contact us anytime by email:
support-tickets@pagepixels.com
Or send us a message through our Support page.