Hey! This is a project built with Stagehand that automates apartment hunting in Vancouver.
This script automates searching apartments.com for Vancouver properties, filtering by price and bedroom count, and extracting detailed unit information into a structured CSV. It visits multiple property listings in sequence and extracts data from the "Pricing & Floor Plans" section of each property.
Key features:
- Automated filtering by price, bed type, and property type
- Multi-property scraping (visits up to 5 listings by default)
- Detailed unit data extraction (price, square footage, floor plan, availability)
- CSV export of all collected data
Get everything ready to run:
npm install
cp .env.example .env
nano .env # Add your Google Generative AI API keyYou can customize your search by modifying these variables at the top of main.ts:
// ======= CONFIGURATION =======
const UNIT_TYPE = "1 Bed"; // Options: "Studio", "1 Bed", "2 Beds", "3+ Beds"
const MIN_PRICE = "2000"; // Minimum price filter
const LOCATION = "mount-pleasant-vancouver-bc"; // Location to search
const MAX_LISTINGS = 5; // Maximum number of properties to visit
// ============================Start the apartment search:
npm startI created this tool as part of my journey to bring modern technology to my traditional finance role in Real Estate. This script represents a step toward fully automating property research and analysis, allowing me to focus on higher-value activities while letting code handle the repetitive data collection tasks.
To run on Browserbase, add your API keys to .env and change env: "LOCAL" to env: "BROWSERBASE" in stagehand.config.ts.
By default, this uses Google's Gemini model with their free API (1000 requests/month free), which I specifically customized to make this project accessible without cost. You can also modify stagehand.config.ts to use:
- OpenAI: Update
modelto"gpt-4o"and use yourOPENAI_API_KEY - Anthropic: Update
modelto"claude-3-5-sonnet-latest"and use yourANTHROPIC_API_KEY
This project wouldn't be possible without:
- BrowserBase and their browser automation platform
- Stagehand for AI-driven web automation
- Google's Generative AI APIs for intelligent extraction