extract
Extracts structured data from the page based on a natural language instruction and a JSON schema.
This uses AI to understand the instruction and locate the relevant information.
Example: extract(instruction: "Extract the product name and price", schema: { type: "object", properties: { name: { type: "string" }, price: { type: "number" } } })
Returns the extracted data as a JSON object.
Definition
Arguments
instruction
: String!
A natural language instruction describing what data to extract.
Example: "Get the user's name and email from the profile page."
schema
: JSONObject!
A JSON schema defining the structure of the data to be extracted.
Example: { "type": "object", "properties": { "productName": { "type": "string" }, "price": { "type": "number" } } }
options
: ExtractOptions
Options for the extraction process, like specifying a root selector or timeout.
Returns
The JSON
scalar type represents JSON values as specified by ECMA-404.