- lat lon on realtor & redfin

pull/5/head
Zachary Hampton 2023-09-18 16:22:47 -07:00
parent d5b4d80f96
commit 8f90a80b0a
2 changed files with 11 additions and 2 deletions

View File

@ -195,6 +195,10 @@ class RealtorScraper(Scraper):
street_post_direction
street_suffix
unit
coordinate {
lon
lat
}
}
}
list_price
@ -245,6 +249,8 @@ class RealtorScraper(Scraper):
unit=parse_unit(result["location"]["address"]["unit"]),
country="USA",
),
latitude=result["location"]["address"]["coordinate"]["lat"],
longitude=result["location"]["address"]["coordinate"]["lon"],
site_name=self.site_name,
property_url="https://www.realtor.com/realestateandhomes-detail/"
+ result["property_id"],

View File

@ -52,7 +52,6 @@ class RedfinScraper(Scraper):
else:
address_info = home["streetAddress"]
street_address, unit = parse_address_two(address_info["assembledAddress"])
unit = parse_address_two(address_info["assembledAddress"])
address = Address(
street_address=street_address,
@ -62,9 +61,11 @@ class RedfinScraper(Scraper):
unit=unit,
country="USA",
)
url = "https://www.redfin.com{}".format(home["url"])
property_type = home["propertyType"] if "propertyType" in home else None
#: property_type = home["propertyType"] if "propertyType" in home else None
lot_size_data = home.get("lotSize")
if not isinstance(lot_size_data, int):
lot_size = (
lot_size_data.get("value", None)
@ -93,6 +94,8 @@ class RedfinScraper(Scraper):
price_per_sqft=get_value("pricePerSqFt"),
price=get_value("price"),
mls_id=get_value("mlsId"),
latitude=home["latLong"]["latitude"] if "latLong" in home else None,
longitude=home["latLong"]["longitude"] if "latLong" in home else None,
)
def _parse_building(self, building: dict) -> Property: