How to Scrape Real Estate Listings
Real estate listing pages are dynamically rendered with extensive JavaScript and include map-based interfaces, filter states, and paginated listing grids. Extracting property data reliably requires handling all these layers consistently.
Step-by-Step Guide
Identify the listing page URL pattern
Real estate sites often use search result pages with filter parameters in the URL. Construct a search URL that targets your desired location and property type.
Fetch the listing page with JavaScript rendering
Send the search URL to AlterLab with render_js enabled. This ensures map-based listing counts and dynamically loaded property cards are included.
Extract individual listing data
Parse property cards from the returned HTML — extract address, price, bedrooms, bathrooms, and square footage using CSS selectors specific to the target site.
Follow pagination to collect all listings
Extract the next-page URL from pagination controls and repeat until all listing pages are collected.
Code Example
import requests
from bs4 import BeautifulSoup
def scrape_listings(search_url: str, api_key: str) -> list[dict]:
response = requests.post(
"https://alterlab.io/api/v1/scrape",
headers={"X-API-Key": api_key, "Content-Type": "application/json"},
json={"url": search_url, "render_js": True},
)
html = response.json().get("html", "")
soup = BeautifulSoup(html, "html.parser")
listings = []
for card in soup.select(".listing-card"):
listings.append({
"address": card.select_one(".address")?.get_text(strip=True),
"price": card.select_one(".price")?.get_text(strip=True),
"beds": card.select_one(".beds")?.get_text(strip=True),
})
return listingsReplace YOUR_API_KEY with your key from the . No credit card required.
Try this yourself with AlterLab
Run this tutorial on live websites with AlterLab's API. Free tier includes 5,000 requests — no credit card required.
Frequently Asked Questions
Can I scrape specific property detail pages as well?
Yes. After collecting listing URLs from search results, send each detail page URL to AlterLab separately to extract full property specifications, description, photos list, and agent contact information.
Responsible Use
AlterLab is designed for extracting publicly available data. Always review the terms of service for any website you access, respect robots.txt directives, and ensure your use case complies with applicable laws in your jurisdiction.
More tutorials
Browse all how-to guides for web scraping — from beginner extractions to advanced multi-page pipelines.
Your first scrape.
Sixty seconds.
$1 free credit — up to 5,000 scrapes. No credit card.
Just a POST request.
No credit card required · $1 free credit, up to 5,000 scrapes · Balance never expires