Skip to content

get_page_data

Retrieve the data of current browser page in JSON format.

Arguments

Name Type Description
tab string The ID of the tab to return the contents for. If not provided, the active tab will be used.
url string The url of the page to get content of. If not provided, the content of the active page will be returned.
schema any A schema to create the json.
timeout number Execution timeout in seconds.

Output

Type: unknown

The data extracted from the page.

Schema definition

/**
* A selector to extract the value. Can optionally end with :html(), :text() or
* :attr("name") to extract the innerHTML, textContent or attribute value.
*/
type SchemaSelector = string;
/**
* Extracts an array of elements.
*/
type SchemaArray = {
type: "array";
selector: string;
schema: Schema;
scroll?: {
selector: string;
direction: "top" | "bottom";
interval?: number;
};
};
/**
* Extracts an object with the given properties.
*/
type SchemaObject = {
type: "object";
selector?: string;
schema: {
[key: string]: Schema;
};
};
/**
* Schema that matches the first schema that matches the data.
*/
type SchemaAny = {
type: "any";
schema: Schema[];
};