Skip to content

Commit

Permalink
- lat lon on realtor & redfin
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacharyHampton committed Sep 18, 2023
1 parent d5b4d80 commit 8f90a80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions homeharvest/core/scrapers/realtor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ def handle_area(
street_post_direction
street_suffix
unit
coordinate {
lon
lat
}
}
}
list_price
Expand Down Expand Up @@ -245,6 +249,8 @@ def handle_area(
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"],
Expand Down
7 changes: 5 additions & 2 deletions homeharvest/core/scrapers/redfin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def get_value(key: str) -> Any | None:
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,
Expand All @@ -62,9 +61,11 @@ def get_value(key: str) -> Any | None:
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)
Expand Down Expand Up @@ -93,6 +94,8 @@ def get_value(key: str) -> Any | None:
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:
Expand Down

0 comments on commit 8f90a80

Please sign in to comment.