# Fotocasa Scraper

Scrapear toda la información detallada (nombre de la vivienda, precio, características destacadas, ubicación, comentarios del anunciante, etc.) de Fotocasa utilizando la URL

- Template page: [https://www.octoparse.com/template/fotocasa-es-scraper](https://www.octoparse.com/template/fotocasa-es-scraper)
- Categories: Real Estate
- Status: `PUBLISHED`
- Run mode: `BOTH`

## Pricing

Free.

## What is an Octoparse template?

An Octoparse template is a ready-to-use scraping workflow with predefined inputs and structured outputs. Use the exact parameter keys below; do not invent parameters.

## Overview

This ready-to-use template collects structured data from detail pages.

## Output

The current workflow extracts 6 fields, including `Característica_1`, `Característica_2`, `Original_URL`, `Precio`, `Ubicación`, `fecha_de_publicación`.

## Use Cases

- Use structured results for research, comparison, and monitoring.
- Collect rows without building the extraction workflow from scratch.
- Combine results with other templates for downstream enrichment.
- Review a representative result before starting a large batch.

## Why Octoparse

- **No coding required:** complete Urls (with parameter "page") and start the template in local or cloud mode.
- **Flexible export:** review and export results as CSV, Excel, or JSON.

## Input

### Urls (with parameter "page")

Required. Urls (with parameter "page") Constraints: minItems=1; maxItems=100000; items.minLength=1; items.maxLength=100000.

## How to Use

# Fotocasa Scraper

## How to use

1. Go to the **Fotocasa Scraper** template to get a list of detail-page URLs. If you already have the URLs, skip this step.
2. Click **Try it!**
3. Enter detail-page URL(s).
4. Click **Run** and choose your preferred run mode.

## Input

**URL:** Fotocasa listing URLs with the page number. Supports multiple URLs per batch.

## Notes

- The URL must include the page number.
- Each listing page returns about 30 properties. Add more pages for more results.
- Some fields may be empty if the listing does not show them.
- Add URLs for all listings you need, for sale or rent; they are processed in the same run.
- Extracted data includes price, location, rooms, bathrooms, and listing age. It does not include surface, photos, or contact data.
- No coding is required: paste the URLs and click **Run**. You can also launch the template via API or from an AI agent with Octoparse MCP.

## Legality

Fotocasa scraping is generally legal if you scrape publicly available, non-personal data. What you do with the data is separate. Learn more about the legality of web scraping in this [post](https://helpcenter.octoparse.com/es/articles/6471169-es-legal-y-etico-utilizar-octoparse-para-raspar-datos-en-sitios-web). If you are unsure, seek professional legal advice.

## Limitations

Results depend on what the source site exposes at run time. Fields may be empty when a source page does not provide a value. The template enforces the input limits shown above.

## Tips

Use specific, valid inputs and review a representative result before starting a large batch. Remove duplicate inputs when repeated records are not needed.

## FAQ

### What do I need to enter?

Use the exact inputs and limits listed above.

### What data does this template return?

See Output Schema below; availability can vary by source record.

### How is usage billed?

See the Pricing section above for current pricing and billing details.

## Related Templates

- [Google Search Scraper](https://www.octoparse.com/template/google-search-scraper)
- [Google Maps Listings Scraper (by Keywords)](https://www.octoparse.com/template/google-maps-scraper-listing-page-by-keyword)
- [Google Maps Email Scraper & Extractor](https://www.octoparse.com/template/google-maps-contact-scraper)
- [Google Maps Leads Scraper](https://www.octoparse.com/template/google-maps-scraper-store-details-by-keyword)
- [Google Maps Listings Scraper (by URLs)](https://www.octoparse.com/template/google-maps-scraper-listing-page-by-url)

## Input Schema

```json
{
  "title": "Fotocasa Scraper input",
  "description": "Input parameters configured for the current published template version.",
  "type": "object",
  "schemaVersion": 1,
  "additionalProperties": false,
  "properties": {
    "urls": {
      "title": "Urls (with parameter \"page\")",
      "description": "Urls (with parameter \"page\")",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100000
      },
      "minItems": 1,
      "maxItems": 100000,
      "x-octoparse": {
        "apiEnabled": true
      }
    }
  },
  "required": [
    "urls"
  ]
}
```

## Input JSON Example

Example 1

```json
{
  "urls": [
    "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1",
    "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/2"
  ]
}
```

Example 2

```json
{
  "urls": [
    "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1",
    "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/2"
  ]
}
```

Example 3

```json
{
  "urls": [
    "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1"
  ]
}
```

Example 4

```json
{
  "urls": [
    "https://www.fotocasa.es/es/alquiler/viviendas/madrid-capital/todas-las-zonas/l/1",
    "https://www.fotocasa.es/es/comprar/viviendas/valencia-capital/todas-las-zonas/l/1",
    "https://www.fotocasa.es/es/comprar/viviendas/sevilla-capital/todas-las-zonas/l/1"
  ]
}
```

Example 5

```json
{
  "urls": [
    "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1",
    "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/2"
  ]
}
```


## Output Schema

```json
{
  "schemaVersion": 1,
  "type": "object",
  "properties": {
    "Característica_1": {
      "type": "string",
      "description": ""
    },
    "Característica_2": {
      "type": "string",
      "description": ""
    },
    "Original_URL": {
      "type": "string",
      "description": ""
    },
    "Precio": {
      "type": "string",
      "description": ""
    },
    "Ubicación": {
      "type": "string",
      "description": ""
    },
    "fecha_de_publicación": {
      "type": "string",
      "description": ""
    }
  },
  "title": "Fotocasa Scraper output",
  "description": "Initial output fields derived from the current published implementation. Field descriptions are maintained by Data Center; production field names and types should be refreshed from recent successful runs.",
  "additionalProperties": false
}
```

## Output Example

Example 1

```json
{
  "Característica_1": "3 habs",
  "Característica_2": "4 baños",
  "Original_URL": "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1",
  "Precio": "1.695.000 €",
  "Ubicación": "Sarrià, Barcelona",
  "fecha_de_publicación": "Más de 3 meses"
}
```

Example 2

```json
{
  "Característica_1": "2 habs",
  "Característica_2": "2 baños",
  "Original_URL": "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1",
  "Precio": "185.000 €",
  "Ubicación": "El Raval, Barcelona",
  "fecha_de_publicación": "Más de 3 meses"
}
```

Example 3

```json
{
  "Característica_1": "2 habs",
  "Característica_2": "1 baño",
  "Original_URL": "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1",
  "Precio": "215.000 €",
  "Ubicación": "La Prosperitat, Nou Barris",
  "fecha_de_publicación": "Más de 3 meses"
}
```

Example 4

```json
{
  "Característica_1": "1 hab",
  "Característica_2": "1 baño",
  "Original_URL": "https://www.fotocasa.es/es/comprar/viviendas/valencia-capital/todas-las-zonas/l/1",
  "Precio": "210.000 €",
  "Ubicación": "La Seu, Ciutat Vella ",
  "fecha_de_publicación": "Más de 3 meses"
}
```

Example 5

```json
{
  "Característica_1": "3 habs",
  "Característica_2": "1 baño",
  "Original_URL": "https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1",
  "Precio": "373.000 €",
  "Ubicación": "El Camp de l'Arpa del Clot, Sant Martí",
  "fecha_de_publicación": "Hace 25 días"
}
```

## API

`POST https://openapi.octoparse.com/api/agentTools/executeTask`

This is the OpenAPI Agent Tools `executeTask` endpoint. Authenticate with a Bearer token.

Request body:

`templateName` is the template slug; `parameters` is a JSON object string whose keys match Input Schema; `taskName`, `idempotencyKey`, and `maxCollectedRows` are optional.

Obtain a token:

```http
POST https://openapi.octoparse.com/token
Content-Type: application/json

{
  "username": "YOUR_USERNAME",
  "password": "YOUR_PASSWORD",
  "grant_type": "password"
}
```

Use `data.access_token` as `Authorization: Bearer <token>`. After starting, poll `getTaskStatus` and export with `exportData`.

```json
{
  "templateName": "fotocasa-es-scraper",
  "taskName": "Fotocasa Scraper",
  "parameters": "{\"urls\":[\"https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1\",\"https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/2\"]}"
}
```

## Python Example

```python
import json
import requests

OPENAPI_BASE = "https://openapi.octoparse.com"
ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"

parameters = json.loads("{\"urls\":[\"https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1\",\"https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/2\"]}")

response = requests.post(
    f"{OPENAPI_BASE}/api/agentTools/executeTask",
    headers={
        "Authorization": f"Bearer {ACCESS_TOKEN}",
        "Content-Type": "application/json",
    },
    json={
        "templateName": "fotocasa-es-scraper",
        "taskName": "Fotocasa Scraper",
        "parameters": json.dumps(parameters, ensure_ascii=False),
    },
    timeout=60,
)
print(response.status_code)
print(response.json())
```

## HTTP/cURL Example

```bash
curl -X POST "https://openapi.octoparse.com/api/agentTools/executeTask" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "templateName": "fotocasa-es-scraper",
  "taskName": "Fotocasa Scraper",
  "parameters": "{\"urls\":[\"https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/1\",\"https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l/2\"]}"
}
JSON
```

## MCP Setup

Connect an MCP-compatible AI client to `https://mcp.octoparse.com` using browser OAuth or an Octoparse API key. Find `fotocasa-es-scraper`, inspect its inputs, create a cloud task with the exact Input Schema keys, and export JSON results.

## Machine-readable Resources

- [Template contract](https://www.octoparse.com/templates/fotocasa-es-scraper.json)
- [Manifest](https://www.octoparse.com/templates/fotocasa-es-scraper-manifest.json)
