> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notte.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# scrape

> Scrape the current page data

<Tip>
  STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md).

  Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch.

  Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages.

  Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code.

  SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior.
</Tip>

This endpoint is a wrapper around the `session.scrape` method that automatically starts a new session, goes to the given URL, and scrapes the page.

**Example:**

```python theme={null}
from notte_sdk import NotteClient

client = NotteClient()
markdown = client.scrape("https://www.google.com", only_main_content=False)
```

With structured data:

```python theme={null}
from notte_sdk import NotteClient
from pydantic import BaseModel

# Define your Pydantic model
...

client = NotteClient()
data = client.scrape(
    "https://www.notte.cc",
    response_format=Product,
    instructions="Extract the products names and prices"
)
```

## Parameters

<ParamField path="url" type="str" required>
  The URL to scrape.
</ParamField>

<ParamField path="raise_on_failure" type="bool" default="True">
  If True (default), raises ScrapeFailedError when structured data         extraction fails and returns the extracted data directly. If False, returns         the StructuredData wrapper so user can check .success.
</ParamField>

<ParamField path="selector" type="str | None" />

<ParamField path="scrape_links" type="bool" />

<ParamField path="scrape_images" type="bool" />

<ParamField path="only_main_content" type="bool" />

<ParamField path="use_link_placeholders" type="bool" />

<ParamField path="ignored_tags" type="list" />

<ParamField path="only_images" type="bool" />

<ParamField path="response_format" type="type[pydantic.main.BaseModel] | None" />

<ParamField path="instructions" type="str | None" />

## Returns

`UnionType`\[[`StructuredData[BaseModel]`](/sdk-reference/misc/structureddata.md), [`BaseModel`](/sdk-reference/misc/basemodel.md), `Dict`\[`str`, `Any`], `str`, `list`\[[`ImageData`](/sdk-reference/misc/imagedata.md)]]: returns the extracted data directly.     When raise\_on\_failure=False: returns StructuredData wrapper so user can check .success.     For markdown scraping: returns str.     For image scraping: returns list\[ImageData].
