DEV Community

ReventaData
ReventaData

Posted on Originally published at apify.com AI-assisted

How to Scrape Real Estate & Car Listings from OLX Brazil with OLX Brazil Scraper

1. Introduction

Extracting market intelligence from Latin America's largest classifieds marketplace—OLX Brazil (olx.com.br)—can be a technical nightmare. Between Next.js App Router server-side rendering, strict regional geo-blocking, and aggressive bot defenses, DIY scrapers frequently hit 403 Forbidden pages and captcha challenges.

In this step-by-step OLX Brazil Scraper tutorial, we'll walk through how to scrape OLX Brazil listings at scale without writing custom browser automation scripts, managing proxy pools, or worrying about website layout changes. By the end of this guide, you'll have structured data (prices, vehicle mileage, apartment square footage, neighborhoods, and timestamps) exported directly into CSV, Excel, or JSON.

⏱️ Time estimate: About 10 minutes to set up and run your first extraction.


2. Prerequisites

To follow this tutorial, you only need:

  • A free Apify account (you can sign up in 10 seconds using your GitHub or Google account).
  • A web browser.
  • No coding experience is required to run the Actor and export datasets, though we'll also show Python/API snippets for developers looking to integrate the data into automated pipelines.

3. What You'll Achieve

By following this OLX Brazil Scraper guide, you will extract clean, typed records from any OLX Brazil category or region.

For instance, if you are analyzing the real estate market in Brasília or tracking used Honda Civic prices across São Paulo, you will get:

  • Full listing titles, direct URLs, and primary image links.
  • Exact asking prices in Brazilian Real (BRL) and price drops.
  • Verified geo-locations: City, State (UF), and Neighborhood.
  • Domain-specific typed attributes: area (m²), bedrooms, and parking spaces for real estate; year, mileage (km), and engine size for vehicles.
  • Clean raw attributes dictionary passing through every ad chip (fuel, gearbox, condo fees / IPTU, battery health).

4. Step-by-Step Tutorial Using the Actor

Step 1: Access OLX Brazil Scraper

  1. Head over to the official Actor page: OLX Brazil Scraper — Any Category, Any Keyword.
  2. Click the blue Try for free button.
  3. If you aren't already logged in, you'll be prompted to log in with GitHub or email.
  4. You will immediately land inside the Apify Console, where the input configuration form for the Actor is ready to be filled out.

Step 2: Configure Primary Input & Category Path

The OLX Brazil Scraper is built to be truly generic: instead of hardcoding rigid category menus that break when the platform changes, it takes any URL path segment directly from your browser.

  1. Open olx.com.br in a new tab.
  2. Navigate to your desired vertical or search filter (e.g., Apartments for rent in Brasília or Used SUVs).
  3. Copy the path after olx.com.br/ from the address bar. For example:
    • Real Estate: imoveis/aluguel/apartamentos/estado-df/distrito-federal-e-regiao/brasilia
    • Cars & Vans: autos-e-pecas/carros-vans-e-utilitarios
    • Nationwide: Leave the field completely blank to search all of Brazil!
  4. Paste this string into the Category path (categoryPath) field.
  5. (Optional) Add keywords into Search terms (searchQueries). For example, entering ["Civic", "Corolla"] will search for those specific terms within your selected category.

Step 3: Fine-Tune with Filters & Advanced Settings

OLX Brazil offers granular parameters depending on the vertical:

  • Price Range (minPrice / maxPrice): Enter numbers in BRL (e.g., Min 50000, Max 90000). When left blank, free listings and unpriced items are not discarded.
  • Vehicle Filters:
    • Min / Max Mileage (minMileageKm / maxMileageKm): Filter cars bounded by specific odometer ranges.
    • Accepts Trade-Ins Only (acceptsTradeOnly): Toggle this boolean if you only want listings flagged with the "Aceita trocas" badge.
  • Sort Order (sortBy): Choose between Relevance, Newest first, Cheapest first, or Most expensive first.
  • Row Caps (maxItems & maxPages):
    • maxItems: Defaults to 300 (can be raised if you need large-scale extraction).
    • maxPages: Clamped to 100 pages (OLX Brazil serves an identical hard clamp beyond page 100).
  • Proxy Configuration (proxyConfiguration): The Actor automatically defaults to Apify Unblocker. > ⚠️ Important Note: OLX Brazil blocks standard datacenter and residential proxies outright with a 5.8 KB block page. Keep the default Unblocker setting enabled for 100% reach.

Step 4: Run the Actor

  1. At the bottom-left of the screen, click the green Save & Run (or Start) button.
  2. The run status will immediately shift to Running 🟡.
  3. In the live terminal log window, you'll see the scraper initialize with Apify Unblocker, request the category page, validate pagination, and parse listings.
  4. An average run of 300 items completes in 45 to 60 seconds.

💡 Tip: You do not have to keep your browser tab open! The Actor runs in Apify's cloud container infrastructure. You can close your laptop, and the run will continue uninterrupted.


Step 5: View and Download Results

Once the run finishes, the status badge turns to SUCCEEDED 🟢:

  1. Click on the Storage tab (or scroll down to Export / Dataset).
  2. You'll see a tabular preview of all scraped records with columns for title, price, mileageKm, location, postedAt, and more.
  3. Click the Export button to download your dataset in your preferred format:
    • CSV / Excel for spreadsheet analysis and market reports.
    • JSON for feeding into downstream apps, APIs, or databases.
    • JSONL / XML for data pipelines.

5. Understanding Your Results

Here is an actual record returned by the OLX Brazil Scraper:

{
  "id": "1532323306",
  "title": "Toyota Corolla Cross XRE 2.0 16V Flex AUT 2023",
  "url": "https://df.olx.com.br/distrito-federal-e-regiao/autos-e-pecas/carros-vans-e-utilitarios/toyota-corolla-cross-xre-2-0-16v-flex-aut-2023-1532323306",
  "imageUrl": "https://img.olx.com.br/images/43/430647444372585.jpg",
  "price": 114900,
  "currency": "BRL",
  "location": "Brasília - DF",
  "city": "Brasília",
  "neighbourhood": "Setor Residencial Leste",
  "state": "DF",
  "postedAt": "2026-09-04T02:09:41Z",
  "category": "Carros, vans e utilitários",
  "mileageKm": 82000,
  "color": "Preto",
  "engineSize": "2.0 - 2.9",
  "bodyType": "SUV",
  "year": 2023,
  "acceptsTrade": false,
  "attributes": {
    "vehicle_brand": "Toyota",
    "vehicle_model": "Corolla Cross XRE 2.0 16V Flex",
    "fuel": "Flex",
    "gearbox": "Automático",
    "doors": "4 portas"
  }
}
Enter fullscreen mode Exit fullscreen mode

Key Field Breakdown:

  • id: Unique listing identifier on OLX Brazil.
  • price & currency: Numeric integer price in BRL. Free items return 0; ads without listed prices return null.
  • areaM2 / bedrooms / bathrooms / parkingSpaces: Populated automatically for real estate searches (returns null for cars).
  • mileageKm / year / color / engineSize: Populated for vehicle searches.
  • attributes: A dictionary containing every extra detail chip OLX publishes (e.g. condominio, IPTU, doors, fuel).
  • Zero Seller Identity: In compliance with privacy standards, search cards do not scrape private seller phone numbers or names.

6. Pro Tips & Advanced Usage

1. Bypassing the 100-Page Ceiling (~5,000 Ads)

OLX Brazil enforces a hard platform clamp: page 101 serves identical content to page 100. If you are scraping a high-volume category (like all used cars nationwide), slice your runs by State / Region (estado-sp, estado-rj, estado-mg) or by Price brackets (e.g. R$ 20k-40k, R$ 40k-60k) to extract tens of thousands of items without hitting the ceiling.

2. Guarding Against "Phantom Results"

When an OLX search keyword matches zero items, the site silently renders up to 8 unrelated "Mais recentes" fallback ads. Unlike brittle scrapers that accidentally collect these wrong items, the OLX Brazil Scraper checks the actual 0 - 0 de 0 resultados counter on the page and discards phantom fallback cards automatically.

3. Programmatic Execution via Python

Want to run this scraper on a cron schedule or trigger it from your backend? Use the official Apify Python SDK:

import os
import sys
from itertools import islice
from apify_client import ApifyClient
from apify_client.errors import ApifyApiError

# Load your token from environment variables
APIFY_TOKEN = os.getenv("APIFY_TOKEN")
if not APIFY_TOKEN:
    sys.exit("Error: APIFY_TOKEN environment variable not set.")

client = ApifyClient(APIFY_TOKEN)

run_input = {
    "categoryPath": "autos-e-pecas/carros-vans-e-utilitarios",
    "searchQueries": ["toyota corolla"],
    "minPrice": 80000,
    "maxPrice": 140000,
    "maxItems": 100,
}

def format_price(value):
    if value is None:
        return "Sob consulta"
    return f"R$ {value:,.0f}".replace(",", ".")

try:
    print("🚀 Triggering OLX Brazil Scraper on Apify...")
    run = client.actor("reventadata/olx-scraper").call(run_input=run_input)

    status = run.get("status")
    dataset_id = run.get("defaultDatasetId")

    # Defensive check: verify run actually succeeded before reading
    if status != "SUCCEEDED":
        print(f"⚠️ Actor finished with status: {status} (Dataset ID: {dataset_id})")
        sys.exit(1)

    print(f"✅ Run completed successfully! Dataset ID: {dataset_id}")

    # Paginate through extracted dataset items defensively
    dataset = client.dataset(dataset_id)
    items = list(islice(dataset.iterate_items(), 5))

    if not items:
        print("ℹ️ Query returned 0 results matching criteria.")
    else:
        print(f"📦 Showing first {len(items)} listings:")
        for ad in items:
            price_tag = format_price(ad.get("price"))
            location = ", ".join(filter(None, [ad.get("city"), ad.get("state")])) or "Localização não informada"
            year_tag = f" ({ad.get('year')})" if ad.get("year") else ""
            print(f"• [{price_tag}] {ad.get('title', 'Sem título')} | {location}{year_tag}")

except ApifyApiError as e:
    print(f"❌ Apify API Exception: {e}")
except Exception as e:
    print(f"❌ Unexpected Error: {e}")
Enter fullscreen mode Exit fullscreen mode

7. Troubleshooting Common Issues

  • Error: Run finished with status FAILED (0 rows found):
    • The Actor is intentionally designed to raise an error if zero rows are returned rather than producing an empty file. This protects scheduled alerts from missing schema changes.
    • Fix: Verify that your categoryPath segment exists on olx.com.br and that your keyword and price filters aren't overly restrictive.
  • Proxy Error / Anti-Bot block:
    • If you manually altered the proxyConfiguration field to use datacenter proxies, the run will fail.
    • Fix: Revert proxy settings to Apify Unblocker (apifyProxyGroups: ["UNBLOCKER"]).

8. Next Steps & Automation

Now that you know how to scrape OLX Brazil, you can set up automated scheduled runs inside the Apify Console (under Schedules) to track price fluctuations every morning or push new property listings directly into a webhook or Google Sheets.

  • 🔗 Actor Link: OLX Brazil Scraper on Apify Store
  • 📖 Pricing: Pay-per-event at $0.001 per result ($1.00 per 1,000 listings). No recurring monthly fee—you only pay for data you collect.


Cross-Platform Guides & Formats

Looking for a different format or audience perspective?


Discussion Prompt

💬 What vertical are you planning to extract from OLX Brazil—real estate trends, used car arbitrage, or electronics? Drop a comment below if you have any questions or need custom filter tips!

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.