# Быстрый старт: Fetch

> Первая страница глазами Chrome, подрезка разметки и надстройки

Источник: https://docs.parreq.com/quickstart-fetch/

`/v1/fetch` отдаёт любую страницу такой, какой её видит Chrome — после отработки
скриптов. Обязателен только `url`.

**1. Первый запрос**

    ```python Python
    from parreq import Parreq

    client = Parreq("pr_ВАШКЛЮЧ")
    page = client.fetch("https://example.com")
    print(page.http_status, len(page.html))
    ```

    ```javascript Node
    import { Parreq } from "parreq-client";

    const client = new Parreq({ apiKey: "pr_ВАШКЛЮЧ" });
    const page = await client.fetch({ url: "https://example.com" });
    console.log(page.httpStatus, page.html.length);
    ```

    ```bash cURL
    curl -H "Authorization: Bearer pr_ВАШКЛЮЧ" \
      "https://api.parreq.com/v1/fetch?url=https://example.com"
    ```

    Разметка приходит бесплатно — платить нужно только за надстройки.

**2. Возьмите один блок вместо всей страницы**

    `select` отдаёт только нужный блок. Селектор — CSS, XPath или просто
    название блока.

    ```python Python
    page = client.fetch("https://example.com", select="h1")
    print(page.html)
    ```

    ```javascript Node
    const page = await client.fetch({ url: "https://example.com", select: "h1" });
    console.log(page.html);
    ```

    ```bash cURL
    curl -H "Authorization: Bearer pr_ВАШКЛЮЧ" \
      "https://api.parreq.com/v1/fetch?url=https://example.com&select=h1"
    ```

    Остальные способы подрезки — [Подрезка разметки](https://docs.parreq.com/fetch-tuning).

**3. Дождитесь того, что грузится скриптами**

    Страницы на React и Vue приезжают пустыми, если забрать их сразу.
    `wait_for` ждёт появления блока, а не фиксированную паузу.

    ```bash
    curl -H "Authorization: Bearer pr_ВАШКЛЮЧ" \
      "https://api.parreq.com/v1/fetch?url=https://example.com&wait_for=%23app"
    ```

    Подробнее — [Сколько ждать страницу](https://docs.parreq.com/fetch#сколько-ждать-страницу).

**4. Закажите надстройку**

    Скрипты, стили, сеть, скриншот и копия для `iframe` — платные, каждая
    заказывается через `include` и стоит отдельно.

    ```python Python
    page = client.fetch("https://example.com", include=["screenshot"])
    open("page.jpg", "wb").write(client.screenshot(page.id))
    ```

    ```javascript Node
    const page = await client.fetch({ url: "https://example.com", include: "screenshot" });
    const jpeg = await client.screenshot(page.id);
    ```

    ```bash cURL
    curl -H "Authorization: Bearer pr_ВАШКЛЮЧ" \
      "https://api.parreq.com/v1/fetch?url=https://example.com&include=screenshot"
    ```

    По странице на каждую: [JS](https://docs.parreq.com/fetch-js), [CSS](https://docs.parreq.com/fetch-css),
    [Network](https://docs.parreq.com/fetch-network), [Скриншот](https://docs.parreq.com/fetch-screenshot),
    [Iframe](https://docs.parreq.com/fetch-iframe), [Браузер с окном](https://docs.parreq.com/fetch-headful).

## Что дальше

**[Fetch](https://docs.parreq.com/fetch)**
    Все параметры: эмуляция, ожидание, ленивая подгрузка, текст.

**[Надстройки вместе](https://docs.parreq.com/fetch-combined)**
    Что происходит, когда заказано несколько сразу, и в каком порядке.

**[Подрезка разметки](https://docs.parreq.com/fetch-tuning)**
    select, start_at, exclude, strip и порядок операций.

**[Справочник Fetch](https://docs.parreq.com/api-reference/fetch)**
    Параметры и схема ответа, с примерами на Python и Node.
