Back to articles
How to Scrape Redfin and Realtor.com Property Listings with Python

How to Scrape Redfin and Realtor.com Property Listings with Python

via Dev.to Tutorialagenthustler

Redfin and Realtor.com are the largest US real estate platforms. Extract their data for investment analysis, price comparison, and market tracking. Redfin API import requests , json class RedfinScraper : def __init__ ( self ): self . s = requests . Session () self . s . headers [ " User-Agent " ] = " Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) " def search ( self , region_id , n = 350 ): r = self . s . get ( " https://www.redfin.com/stingray/api/gis " , params = { " al " : 1 , " num_homes " : n , " region_id " : region_id , " region_type " : 6 , " sf " : " 1,2,3,5,6,7 " , " status " : 9 , " v " : 8 }) txt = r . text [ 4 :] if r . text . startswith ( " {}&& " ) else r . text return [{ " address " : h . get ( " streetLine " ,{}). get ( " value " , "" ), " price " : h . get ( " price " ,{}). get ( " value " , 0 ), " beds " : h . get ( " beds " , 0 ), " baths " : h . get ( " baths " , 0 ), " sqft " : h . get ( " sqFt " ,{}). get ( " value " , 0 ), } for h in json . loads ( txt ). get (

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
2 views

Related Articles