Scrape Zillow search results and listing pages in Python with Requests and BeautifulSoup, through IPRoyal residential proxies with US targeting. The scraper reads the JSON that Zillow puts in each page (the __NEXT_DATA__ script), follows one search across its pages on one sticky session, and saves the results as CSV and JSON.
It pauses between requests, and when Zillow answers with 403, 429, or its block page, it backs off and retries on a new session. The defaults use IPRoyal residential proxies, and one setting switches to any other HTTP proxy.
This repo goes with the guide How to Scrape Zillow in 2026: A Step-by-Step Guide (Using Python).
Zillow's Terms of Use cover automated access to its site, including scraping, and its robots.txt lists the paths crawlers may and may not visit. Read both and check that your use case is allowed before you run this code against Zillow.
Python 3.10 or newer.
git clone https://github.com/IPRoyal/zillow-scraper-python.git
cd zillow-scraper-python
pip install -r requirements.txt
cp .env.example .env # then add your proxy username and password
python scrape.py search "https://www.zillow.com/new-york-ny/" --pages 2The listings go to output/search.csv and output/search.json, one row per listing:
{
"zpid": "98333800",
"status_text": "House for sale",
"price": "$824,999",
"price_value": 824999,
"address": "94 Monticello Ter, Staten Island, NY 10308",
"beds": 3,
"baths": 4,
"area_sqft": 1584,
"home_type": "SINGLE_FAMILY",
"detail_url": "https://www.zillow.com/homedetails/94-Monticello-Ter-Staten-Island-NY-10308/98333800_zpid/",
"...": "..."
}Then scrape listing pages for more detail:
python scrape.py listing "https://www.zillow.com/homedetails/94-Monticello-Ter-Staten-Island-NY-10308/98333800_zpid/"| Option | What it does |
|---|---|
search URL --pages 3 |
Scrape a search URL and follow up to 3 result pages (default 1) |
listing URL [URL ...] |
Scrape one or more listing pages |
--country us |
Exit country for this run (overrides IPROYAL_COUNTRY) |
--state california |
US state for this run (overrides IPROYAL_STATE, needs country us) |
--out output/ny |
Output path without extension; writes .csv and .json |
--retries 3 |
Retries per page after a block |
--min-delay 3 --max-delay 8 |
Random pause between requests, in seconds |
-v |
Log each page and retry |
Options go before the command: python scrape.py --state texas search "https://www.zillow.com/austin-tx/". The search command takes a Zillow search URL, such as one copied from your browser.
The defaults point at IPRoyal residential proxies. One endpoint, geo.iproyal.com, handles the three things this scraper needs, all set in the password string (IPRoyal docs):
- Targeting:
.env.examplesets the exit country tous. Add a US state withIPROYAL_STATEor--state(_state-california). City targeting is in the same string (IPROYAL_CITY). - Sticky sessions: each search gets its own 8-character session ID, so the pages of that search go out from one IP. The session keeps its IP for
IPROYAL_LIFETIME(10 minutes by default; 1 second to 7 days). - Rotation: listing pages use the rotating setting, with no session in the password. Each listing request opens a new connection, and IPRoyal can hand out a new IP for each one.
proxy_config.py builds that string from .env, so the scraper only sees a finished proxy URL.
Zillow pages carry their data as JSON in a <script id="__NEXT_DATA__"> tag. The parser (zillow_parser.py) reads that JSON with BeautifulSoup and json, not the visible HTML:
| Page | Where the data is |
|---|---|
| Search results | props.pageProps.searchPageState.cat1.searchResults.listResults, one object per listing |
| Next page | props.pageProps.searchPageState.cat1.searchList.pagination.nextUrl, e.g. /new-york-ny/2_p/ |
| Listing page | props.pageProps.componentProps.gdpClientCache, a JSON string with a property object |
The search paths come from a page captured on 2026-11-21. The listing page got Zillow's block page in our capture, so the listing parser is tested against a hand-built page; scripts/live_check.py checks it against a live one.
Not every listing has every field, so the parser reads each value with .get() and missing values come out empty in the CSV and null in the JSON.
zpid, status_text, price, price_value, address, street, city, state, zipcode, beds, baths, area_sqft, home_type, latitude, longitude, image_url, detail_url
zpid, url, street, city, state, zipcode, price, currency, beds, baths, living_area, living_area_units, home_type, home_status, year_built, days_on_zillow, zestimate, rent_zestimate, latitude, longitude, photo_count, first_photo_url, description
zillow_scraper.py handles the requests:
- A pause before every request after the first, 3 to 8 seconds at random.
- A retry on a block: HTTP 403 or 429, a page with Zillow's block-page markers (checked whatever the status code), or a connection error or timeout.
- Backoff: 10, 20, 40 seconds and so on, plus up to 3 seconds at random, capped at 120 seconds. Three retries by default, then it stops with an error.
- A new session for each retry: a new sticky session ID (so a new IP) and a fresh cookie jar. On a search, the pages after the retry stay on the new session.
If the retries keep failing, slow down or stop, and check Zillow's terms again.
from output import write_csv
from zillow_parser import SEARCH_FIELDS
from zillow_scraper import ProxySessions, RetryPolicy, ZillowScraper
scraper = ZillowScraper(ProxySessions(country="us", state="california"), RetryPolicy(retries=2))
listings = scraper.search("https://www.zillow.com/los-angeles-ca/", max_pages=2)
details = scraper.listings(item["detail_url"] for item in listings[:3])
write_csv(listings, "output/la.csv", SEARCH_FIELDS)ProxySessions() with no arguments takes everything from .env.
| Script | What it does |
|---|---|
search_example.py |
Two pages of a New York search on one sticky US session, saved to CSV and JSON |
listing_example.py |
The facts of one listing page (pass a URL, or it takes the first search result) |
us_targeting.py |
Prints the exit country and region for country-us, state-california and state-texas, using ipinfo.io. It doesn't touch Zillow. |
- The guide's first example reads listings from
searchPageState.listResults. On the page we captured, they sit undersearchPageState.cat1.searchResults.listResults, as in the guide's second example. - The scraper follows the next-page link from the page itself (
pagination.nextUrl) instead of building page URLs. - Results go to CSV and JSON with the standard library, so pandas isn't needed. Load the CSV into pandas if you want a DataFrame.
- Every request goes through a proxy, with pauses, retries and a User-Agent that names the tool.
Set PROXY_URL in .env and the scraper uses it for every request instead of the IPRoyal settings:
PROXY_URL=http://user:pass@proxy.example.com:8080Sessions and targeting are IPRoyal password options, so with PROXY_URL every request goes through that URL as is. A retry still opens a new connection with a fresh cookie jar.
The scraper uses the HTTP port. To use SOCKS5, set IPROYAL_SCHEME=socks5 and pip install "requests[socks]".
pip install -r requirements-dev.txt
pytestThe offline tests need no proxy account and no network. A local mock proxy asks for credentials, records what the scraper sends, and replays saved pages, so the tests check that:
- the parser reads the captured search page, the hand-built listing page, and missing fields
- the pages of one search share one sticky session, and each search gets a new one
- 403, 429 and the block page lead to a backoff and a new session, and the scraper stops after the last retry
- state targeting,
PROXY_URLand the CLI's CSV and JSON output work
tests/fixtures/README.md says where each saved page comes from and which one is hand-built. The tests run on every push (test.yml).
The live check runs through IPRoyal. It checks that country-us exits in the US and state-california in California, that a sticky session keeps one IP, and that both parsers read a live Zillow search page and listing page:
python scripts/live_check.pyOn GitHub it runs by hand from the Actions tab (live-check.yml) with the IPROYAL_USERNAME and IPROYAL_PASSWORD secrets.
scrape.py command line: search or listing, CSV and JSON out
zillow_scraper.py requests, sticky sessions per search, delays, retries
zillow_parser.py reads __NEXT_DATA__ from search and listing pages
output.py CSV and JSON writers
proxy_config.py builds the proxy URL from .env (IPRoyal options or PROXY_URL)
examples/ search, listing and US targeting scripts
scripts/live_check.py live run through IPRoyal
tests/ offline tests with a local mock proxy and saved pages
The guide also covers why people collect Zillow data, browser tools such as Selenium and Playwright for larger projects, charting price trends with pandas and Matplotlib, and common errors: How to Scrape Zillow in 2026: A Step-by-Step Guide (Using Python).
