# Apolar Scraper - Casas e Sobrados para Alugar (`alexschi/apolar-scraper`) Actor

Scraper não-oficial da Apolar Imóveis (www.apolar.com.br). Extrai casas/sobrados para aluguel com filtros por cidade, quartos, preço e remoção automática de LOCADA (rented-stamp) e EM NEGOCIAÇÃO. Ideal para rastreio diário em Curitiba.

- **URL**: https://apify.com/alexschi/apolar-scraper.md
- **Developed by:** [Alex Silva](https://apify.com/alexschi) (community)
- **Categories:** Automation, Travel, Real estate
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 apolar imóvels

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Apolar Scraper — Casas e Sobrados para Alugar

**Primeiro Actor dedicado à Apolar Imóveis no Apify Store.** Extraia casas e sobrados para aluguel direto do site `www.apolar.com.br` com detecção automática do selo **LOCADA** (`rented-stamp`) e do texto **EM NEGOCIAÇÃO**.

Validado em Curitiba em 26/08/2026 com o link:
`https://www.apolar.com.br/alugar/casa-residencial/curitiba/2-quartos?mensal&country=Brasil&price_max=R%24%203.300,00`
→ 60 cards carregados (4× *Carregar mais imóveis*) → **28 LOCADA + 20 EM NEGOCIAÇÃO + 12 DISPONÍVEIS** filtrados automaticamente. Custo Apify **US$ 0,010**.

### Por que usar este Actor

- **URL SEO direta** da Apolar (não precisa clicar em filtros) — monta `/alugar/casa-residencial/{cidade}/{qtos}-quartos?mensal&price_max=...`
- **Paginação automática** clicando em *Carregar mais imóveis* até `maxItems`
- **Filtro cirúrgico de disponibilidade** — detecta no HTML:
  ```html
  <img alt="Imóvel Locado" src="/img/rented-stamp.d5e19c74.webp">
  <div class="property-seal-component seal-type-situacao">
  ```
  e texto `EM NEGOCIAÇÃO` — remove antes de salvar
- **Campos normalizados** prontos para deduplicação diária (URL, bairro, rua, área, quartos, vagas, banheiros, preço)

### Input

| Campo | Tipo | Padrão | Descrição |
|---|---|---|---|
| `cidade` | string | `curitiba` | Cidade slug |
| `tipoImovel` | string\[] | `["casa","sobrado"]` | `casa` inclui `SOBRADO` (casa-residencial) |
| `quartosMin` | integer | `2` | 1–4 |
| `precoMax` | integer | `3300` | R$ |
| `finalidade` | `alugar`/`comprar` | `alugar` | |
| `excluirLocada` | boolean | `true` | Remove selo rented-stamp |
| `excluirEmNegociacao` | boolean | `true` | Remove EM NEGOCIAÇÃO |
| `maxItems` | integer | `30` | 5–60 |
| `startUrls` | requestList | `[]` | Se preencher, ignora montagem e usa URL direta |
| `proxyConfiguration` | proxy | Apify Proxy | Recomendado RESIDENTIAL |

Exemplo — seu caso:

```json
{
  "cidade": "curitiba",
  "tipoImovel": ["casa", "sobrado"],
  "quartosMin": 2,
  "precoMax": 3300,
  "excluirLocada": true,
  "excluirEmNegociacao": true,
  "maxItems": 30
}
```

Ou use `startUrls` com a URL exata que você já usa.

### Output (dataset)

Cada item:

```json
{
  "id": "109050",
  "url": "https://www.apolar.com.br/alugar/curitiba/alto-boqueirao/...-109050?",
  "titulo": "SOBRADO 3 qtos - Alto Boqueirão - 132m²",
  "tipo": "SOBRADO",
  "bairro": "Alto Boqueirão",
  "rua": "Rua São Francisco De Sales",
  "cidade": "curitiba",
  "quartos": 3,
  "vagas": 2,
  "areaM2": 132,
  "banheiros": 1,
  "preco": 3300,
  "precoRaw": "R$ 3.300,00",
  "status": "DISPONIVEL",
  "fonte": "Apolar"
}
```

`APOLAR_STATS` salvo no Key-Value Store:

```json
{ "totalCards": 60, "locadas": 28, "negociacao": 20, "disponiveis": 12 }
```

### Custos

Crawler Playwright + Chromium. Média observada: **US$ 0,010 para 60 cards / US$ 0,004 para 30** (compute + proxy). Preço sugerido no Store: **US$ 0,001 por resultado** (`PAY_PER_EVENT`) — Apify retém 20–30%, seu lucro ~US$ 0,05 por run de 30.

Benchmark vizinhos: ZAP 9k runs US$ 0,001, Imovelweb 5k US$ 0,002.

### Como publicar e vender

```bash
npm i -g apify-cli
apify login  # seu token Apify (não colar no chat)
cd apolar-scraper
apify push   # sobe para sua conta
## No Apify Console > Actors > apolar-scraper > Publish to Store > preencher título, descrição, preço
```

Requisitos Store: ícone 600×600, screenshots, README, suporte. Aprovação em 1–3 dias. Monitore quebras de layout (Apolar é Vue SPA, `app.<hash>.js` muda; seletor `.property-component` e botão `Carregar mais imóveis` precisam ser revisados).

### Aviso legal

Actor **não-oficial**, sem vínculo com Apolar Imóveis. Acesse apenas dados públicos e respeite `robots.txt` e ToS da Apolar. Use `useApifyProxy: true` e não abuse de concorrência.

### Teste local

```bash
npm install
apify run --input '{"cidade":"curitiba","precoMax":3300,"maxItems":12}'
```

Dataset em `storage/datasets/default/*.json`.

# Actor input Schema

## `cidade` (type: `string`):

Cidade para busca (ex: curitiba, sao-paulo). Usado para montar URL SEO da Apolar.

## `estado` (type: `string`):

UF ou estado por extenso (ex: pr). Se vazio, usa só cidade.

## `tipoImovel` (type: `array`):

Filtre por tipo. Apolar distingue Casa e Sobrado.

## `quartosMin` (type: `integer`):

Mínimo de quartos (1-4). Mapeia para /2-quartos, /3-quartos etc.

## `precoMax` (type: `integer`):

Filtra ?price\_max=R$ X. Use 3300 para seu teto.

## `finalidade` (type: `string`):

Comprar ou Alugar

## `excluirLocada` (type: `boolean`):

Se true, remove cards com <img alt="Imóvel Locado" src="/img/rented-stamp"> (selo seal-type-situacao).

## `excluirEmNegociacao` (type: `boolean`):

Se true, remove cards cujo texto contém 'EM NEGOCIAÇÃO'.

## `maxItems` (type: `integer`):

Quantos imóveis retornar (após filtros). Apolar carrega 12 por página + Carregar mais.

## `startUrls` (type: `array`):

Opcional: sobrescreve a montagem automática. Use a URL SEO exata da Apolar se quiser.

## `proxyConfiguration` (type: `object`):

Use Apify Proxy para evitar bloqueio.

## Actor input object example

```json
{
  "cidade": "curitiba",
  "tipoImovel": [
    "casa",
    "sobrado"
  ],
  "quartosMin": 2,
  "precoMax": 3300,
  "finalidade": "alugar",
  "excluirLocada": true,
  "excluirEmNegociacao": true,
  "maxItems": 30,
  "startUrls": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `imoveis` (type: `string`):

Dataset com casas e sobrados disponíveis para aluguel.

## `estatisticas` (type: `string`):

Resumo dos imóveis encontrados e filtrados.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "cidade": "curitiba",
    "estado": "",
    "tipoImovel": [
        "casa",
        "sobrado"
    ],
    "quartosMin": 2,
    "precoMax": 3300,
    "finalidade": "alugar",
    "excluirLocada": true,
    "excluirEmNegociacao": true,
    "maxItems": 30,
    "startUrls": [],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("alexschi/apolar-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "cidade": "curitiba",
    "estado": "",
    "tipoImovel": [
        "casa",
        "sobrado",
    ],
    "quartosMin": 2,
    "precoMax": 3300,
    "finalidade": "alugar",
    "excluirLocada": True,
    "excluirEmNegociacao": True,
    "maxItems": 30,
    "startUrls": [],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("alexschi/apolar-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "cidade": "curitiba",
  "estado": "",
  "tipoImovel": [
    "casa",
    "sobrado"
  ],
  "quartosMin": 2,
  "precoMax": 3300,
  "finalidade": "alugar",
  "excluirLocada": true,
  "excluirEmNegociacao": true,
  "maxItems": 30,
  "startUrls": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call alexschi/apolar-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alexschi/apolar-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/lr0LsguwPwq59OtFL/builds/BKQNo7gv4FAHiX6lq/openapi.json
