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

ParameterRequiredDetails

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. The default value is "0".

Extraction Rules examples

GET https://scrape.shifter.io/v1?api_key=api_key&url=https://example.com&extract_rules={"title": {"selector": "h1", "output": "text"}}

⇡ Input

curl --request GET --url "https://scrape.shifter.io/v1?api_key=api_key&&url=https%3A%2F%2Fexample.com&extract_rules=%7B%22title%22%3A%20%7B%22selector%22%3A%20%22h1%22%2C%20%22output%22%3A%20%22text%22%7D%7D"

⇣ Output

{"title": "Example Domain"}

Last updated