Docs
API 1.39
Status
Fields

attr

The `attr` option of an extract field.

Reads an attribute instead of the text: an attribute name such as href, @html for the inner HTML or @outer for the outer HTML. Defaults to the normalized text content.

Type: string

#Example

{
  "url": {
    "selector": "a",
    "attr": "href",
    "type": "url",
    "base_url": "https://shop.example.com"
  }
}

From the contract fixture product-page-list-regex-json, a program the test suite validates.

Was this page helpful?