Extraction Rules

Using the extract_rules parameter, you can get the scraped site based on various extraction rules.

Extraction rules can be applied with both JavaScript rendering enabled or disabled.

Possible extraction rules:

Parameter Required Details
selector true The CSS selector.
output false Choose between html, text or @[attr]. Default value is html
all false Set this parameter to "1" to return all the html elements. Default value is "0".
Extraction Rules examples

Extraction Rules

GET external-link
https://api.webscrapingapi.com/v1?api_key={{api_key}}&url=https://webscrapingapi.com&extract_rules=%7B%22title%22%3A%20%7B%22selector%22%3A%20%22h1%22%2C%20%22output%22%3A%20%22text%22%7D%2C%20%22subtitle%22%3A%20%7B%22selector%22%3A%20%22p.p-big%22%2C%20%22output%22%3A%20%22text%22%7D%7D
Code to integrate
external-link
Response Example external-link
{"title":"The leading REST API for web scraping","subtitle":"Join 10,000+ businesses that use WebScrapingAPI to gather
data at scale.WebScrapingAPI collects the HTML from any web page using a simple API and provides\n ready-to-process data
to everyone in your company.Use one API to collect data, from any website. Integrate with any development language and\n
customize your\n requests in just 30 seconds."}