Zillow Property Data Scrape
Pricing
Pay per usage
Go to Store
Zillow Property Data Scrape
Under maintenanceScrape zillow property data by address
0.0 (0)
Pricing
Pay per usage
0
2
1
Last modified
2 months ago
.actor/Dockerfile
# Specify the base Docker image. You can read more about# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images# You can also use any other image from Docker Hub.FROM apify/actor-node:20 AS builder
# Check preinstalled packagesRUN npm ls crawlee apify puppeteer playwright
# Copy just package.json and package-lock.json# to speed up the build using Docker layer cache.COPY package*.json ./
# Install all dependencies. Don't audit to speed up the installation.RUN npm install --include=dev --audit=false
# Next, copy the source files using the user set# in the base image.COPY . ./
# Install all dependencies and build the project.# Don't audit to speed up the installation.RUN npm run build
# Create final imageFROM apify/actor-node:20
# Check preinstalled packagesRUN npm ls crawlee apify puppeteer playwright
# Copy just package.json and package-lock.json# to speed up the build using Docker layer cache.COPY package*.json ./
# Install NPM packages, skip optional and development dependencies to# keep the image small. Avoid logging too much and print the dependency# tree for debuggingRUN npm --quiet set progress=false \ && npm install --omit=dev --omit=optional \ && echo "Installed NPM packages:" \ && (npm list --omit=dev --all || true) \ && echo "Node.js version:" \ && node --version \ && echo "NPM version:" \ && npm --version \ && rm -r ~/.npm
# Copy built JS files from builder imageCOPY /usr/src/app/dist ./dist
# Next, copy the remaining files and directories with the source code.# Since we do this after NPM install, quick build will be really fast# for most source file changes.COPY . ./
# Create and run as a non-root user.RUN adduser -h /home/apify -D apify && \ chown -R apify:apify ./USER apify
# Run the image.CMD npm run start:prod --silent
.actor/actor.json
{ "actorSpecification": 1, "name": "my-actor", "title": "Scrape single page in TypeScript", "description": "Scrape data from single page with provided URL.", "version": "0.0", "meta": { "templateId": "ts-start" }, "input": "./input_schema.json", "dockerfile": "./Dockerfile"}
.actor/input_schema.json
{ "title": "Zillow Scraper Input", "description": "Input for scraping Zillow property by address.", "type": "object", "schemaVersion": 1, "properties": { "address": { "title": "Property Address", "type": "string", "description": "Enter the full property address (e.g., '17 Zelma Dr, Greenville, SC 29617').", "editor": "textfield", "minLength": 5 } }, "required": ["address"]}
src/main.ts
1import { Actor, Dataset } from 'apify';2
3await Actor.init();4
5interface Input {6 address: string;7}8
9const input = await Actor.getInput<Input>();10if (!input?.address) throw new Error("Missing input!");11
12const { address } = input;13
14const zpidScraperInput = {15 multiple_input_box: address,16 scrape_type: "property_addresses",17};18
19const zpidRun = await Actor.call('sorower/zillow-scrape-address-url-zpid', zpidScraperInput);20if (!zpidRun.defaultDatasetId) throw new Error('No default dataset ID from the ZPID scraper.');21
22const zpidDataset = await Dataset.open(zpidRun.defaultDatasetId);23const { items } = await zpidDataset.getData();24
25if (!items.length || !items[0].PropertyZillowURL) {26 throw new Error('PropertyZillowURL not found');27}28
29const originalUrl = items[0].PropertyZillowURL;30const zpidMatch = originalUrl.match(/(\d+)_zpid/);31if (!zpidMatch) throw new Error('ZPID not found');32const zpid = zpidMatch[1];33
34function formatAddress(address: string): string {35 return address.replace(/,/g, '').replace(/\s+/g, '-').replace(/-{2,}/g, '-').trim();36}37
38const formattedAddress = formatAddress(address);39const finalUrl = `https://www.zillow.com/homedetails/${formattedAddress}/${zpid}_zpid/`;40
41const detailScraperInput = {42 extractBuildingUnits: 'all',43 propertyStatus: 'FOR_SALE',44 startUrls: [45 {46 url: finalUrl,47 method: 'GET',48 },49 ],50};51
52const detailRun = await Actor.call('maxcopell/zillow-detail-scraper', detailScraperInput);53if (!detailRun.defaultDatasetId) throw new Error('No default dataset ID from the detail scraper.');54
55const detailDataset = await Dataset.open(detailRun.defaultDatasetId);56const detailItems = await detailDataset.getData();57
58await Actor.pushData({59 inputAddress: address,60 detailData: detailItems.items[0],61});62
63await Actor.exit();
.dockerignore
# configurations.idea.vscode
# crawlee and apify storage foldersapify_storagecrawlee_storagestorage
# installed filesnode_modules
# git folder.git
# dist folderdist
.editorconfig
root = true
[*]indent_style = spaceindent_size = 4charset = utf-8trim_trailing_whitespace = trueinsert_final_newline = trueend_of_line = lf
.eslintrc
{ "root": true, "env": { "browser": true, "es2020": true, "node": true }, "extends": [ "@apify/eslint-config-ts" ], "parserOptions": { "project": "./tsconfig.json", "ecmaVersion": 2020 }, "ignorePatterns": [ "node_modules", "dist", "**/*.d.ts" ]}
.gitignore
# This file tells Git which files shouldn't be added to source control
.idea.vscode.zedstorageapify_storagecrawlee_storagenode_modulesdisttsconfig.tsbuildinfostorage/*!storage/key_value_storesstorage/key_value_stores/*!storage/key_value_stores/defaultstorage/key_value_stores/default/*!storage/key_value_stores/default/INPUT.json
package.json
{ "name": "ts-start", "version": "0.0.1", "type": "module", "description": "This is an example of an Apify actor.", "engines": { "node": ">=18.0.0" }, "dependencies": { "apify": "^3.2.6", "axios": "^1.5.0", "cheerio": "^1.0.0-rc.12" }, "devDependencies": { "@apify/eslint-config-ts": "^0.3.0", "@apify/tsconfig": "^0.1.0", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", "eslint": "^8.50.0", "tsx": "^4.6.2", "typescript": "^5.3.3" }, "scripts": { "start": "npm run start:dev", "start:prod": "node dist/main.js", "start:dev": "tsx src/main.ts", "build": "tsc", "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1" }, "author": "It's not you it's me", "license": "ISC"}
tsconfig.json
{ "extends": "@apify/tsconfig", "compilerOptions": { "module": "NodeNext", "moduleResolution": "NodeNext", "target": "ES2022", "outDir": "dist", "noUnusedLocals": false, "skipLibCheck": true, "lib": ["DOM"] }, "include": [ "./src/**/*" ]}