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).
Click the empty space beside the folder path above.
Type cmd
and press Enter
.
Command Prompt
will open.
Enter the following command in the Command Prompt
then press Enter
. This is to create a Python virtual environment.
python -m venv venv
Wait for it to finish. Once finished, a new folder named venv
is created.
Now, to activate the virtual environment, run the following command:
venv\Scripts\activate.bat
Once activated, you’d see (venv)
on the left side.
Go to this Github link to download the files we need. Click Code
then Download ZIP
.
Once downloaded, open the zip file and copy these two files.
Paste them to your folder.
Run this command to install the requirements.
pip install -r requirements.txt
You’d see something like this when it runs. Wait for it to finish.
Run this command to install browser binaries.
playwright install
You’d see something like this when installing. Wait for it to finish.
Open main.py
file in a Notepad
or any text editor you like.
Search for insert
. You should see this part of the code.
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.
Save the file.
Now, the moment of truth. Run this command to start scraping!
python main.py
You’d see something like this when it starts running. Wait for it to finish.
When it starts running, it will create a 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.