function extractStructuredDataFromPage(page, options): Promise<any>

Extracts structured data from a web page.

Examples

Parameters

page: Page

The Playwright Page from which to extract the structured data.

options

options.dataSchema: JsonSchema

The JSON schema of the data you’re trying to extract.

options.label: string

A label for this extraction process, used for billing and monitoring.

options.prompt?: string

Optional. A prompt to guide the extraction process and provide more context.

options.strategy?: ImageStrategy | HtmlStrategy

Optional. The strategy to use for extraction, use the IMAGE strategy if the info you’re trying to extract is visual and does not exist on the html of the page,

Returns

Promise<any>

A promise that resolves to the extracted structured data.