Skip to main content

Built-in Templates

Templates are ready-made extractors for the things people scrape most often. Add a templates array to any request and the results come back under data.template_extracted — no CSS selectors required.

Available templates​

TemplateExtracts
linksAll anchor URLs on the page
imagesAll image URLs
headingsHeading text (h1–h6), grouped by level
emailsEmail addresses found in the page
phone_numbersPhone numbers found in the page
metadata<meta> tags, title, Open Graph data
tablesHTML tables parsed into rows and columns

Example​

curl -X POST https://api.omniscrape.io/v1/scrape \
-H "X-API-Key: $OMNISCRAPE_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://news.example.com",
"templates": ["links", "images", "headings", "emails"]
}'
{
"data": {
"template_extracted": {
"links": ["https://news.example.com/a", "https://news.example.com/b"],
"images": ["https://cdn.example.com/1.jpg"],
"headings": { "h1": ["Top Stories"], "h2": ["World", "Tech"] },
"emails": ["press@example.com"]
}
}
}

Combining templates with other features​

Templates work alongside everything else — modes, proxies, and CSS extraction. For example, get a contact email and the company name in one call:

{
"url": "https://company.example.com/about",
"templates": ["emails", "phone_numbers"],
"css_selectors": { "company": "h1.company-name" }
}

You'll receive both data.template_extracted and data.css_extracted.

Templates vs CSS extraction​

  • Use templates for generic, page-wide collections (every link, every image, all emails).
  • Use CSS extraction when you need specific, named fields from known elements (the price, the title, the rating).

Tables​

The tables template is handy for scraping data grids and spec sheets — each table becomes a structured array of rows, so you can drop it straight into a spreadsheet or database without parsing HTML.