Published: 2024-07-23 Last Update: 2024-07-23

Let’s Get Data from Zillow

Install Python if you don’t have it already. You can follow this for the installation.

Once Python is installed, create a folder somewhere (name it whatever you want). create folder

Click the empty space beside the folder path above. click empty space in folder path

Type cmd and press Enter. type cmd

Command Prompt will open. command prompt

Enter the following command in the Command Prompt then press Enter. This is to create a Python virtual environment.

python -m venv venv

python command to create virtual environment

Wait for it to finish. Once finished, a new folder named venv is created. venv folder

Now, to activate the virtual environment, run the following command:

venv\Scripts\activate.bat

Once activated, you’d see (venv) on the left side. activated virtual environment

Go to this Github link to download the files we need. Click Code then Download ZIP. download zip from github

Once downloaded, open the zip file and copy these two files. downloaded files. main.py and requirements.txt

Paste them to your folder. folder files

Run this command to install the requirements.

pip install -r requirements.txt

python command to install requirements

You’d see something like this when it runs. Wait for it to finish. python pip installing

Run this command to install browser binaries.

playwright install

You’d see something like this when installing. Wait for it to finish. playwright. browser installing

Open main.py file in a Notepad or any text editor you like. open main.py file in notepad

Search for insert. You should see this part of the code. search for insert

Replace the INSERT_URL_HERE with your actual URL. Here’s a URL example: https://www.zillow.com/hillsborough-county-fl/rentals/?searchQueryState=%7B%22isMapVisible%22%3Atrue%2C%22mapBounds%22%3A%7B%22north%22%3A28.426348447823905%2C%22south%22%3A27.31557203235698%2C%22east%22%3A-81.48920976269532%2C%22west%22%3A-83.3884712373047%7D%2C%22filterState%22%3A%7B%22ah%22%3A%7B%22value%22%3Atrue%7D%2C%22fr%22%3A%7B%22value%22%3Atrue%7D%2C%22fsba%22%3A%7B%22value%22%3Afalse%7D%2C%22fsbo%22%3A%7B%22value%22%3Afalse%7D%2C%22nc%22%3A%7B%22value%22%3Afalse%7D%2C%22cmsn%22%3A%7B%22value%22%3Afalse%7D%2C%22auc%22%3A%7B%22value%22%3Afalse%7D%2C%22fore%22%3A%7B%22value%22%3Afalse%7D%2C%22apco%22%3A%7B%22value%22%3Afalse%7D%2C%22apa%22%3A%7B%22value%22%3Afalse%7D%2C%22con%22%3A%7B%22value%22%3Afalse%7D%7D%2C%22isListVisible%22%3Atrue%2C%22regionSelection%22%3A%5B%7B%22regionId%22%3A3165%2C%22regionType%22%3A4%7D%5D%2C%22pagination%22%3A%7B%7D%7D

When you replace, be careful not to edit anything else and ensure that the double quotes " are still there. double quotes

Save the file. save the file

Now, the moment of truth. Run this command to start scraping! run python script

python main.py

You’d see something like this when it starts running. Wait for it to finish. python script logs

When it starts running, it will create a zillow.json file. zillow json file

This file will contain all the scraped data. Once the script finishes, you can open the json file in Notepad or in any text editor you like.

If you don’t know how to consume a json file, you may convert it to csv. Just Google for json to csv converter.