diff --git a/homeharvest/core/scrapers/models.py b/homeharvest/core/scrapers/models.py index 3238436..5ddc171 100644 --- a/homeharvest/core/scrapers/models.py +++ b/homeharvest/core/scrapers/models.py @@ -25,6 +25,7 @@ class SiteName(Enum): class SearchPropertyType(Enum): SINGLE_FAMILY = "single_family" + APARTMENT = "apartment" CONDOS = "condos" CONDO_TOWNHOME_ROWHOME_COOP = "condo_townhome_rowhome_coop" CONDO_TOWNHOME = "condo_townhome" diff --git a/homeharvest/core/scrapers/realtor/__init__.py b/homeharvest/core/scrapers/realtor/__init__.py index e0e5207..85342c3 100644 --- a/homeharvest/core/scrapers/realtor/__init__.py +++ b/homeharvest/core/scrapers/realtor/__init__.py @@ -257,7 +257,7 @@ class RealtorScraper(Scraper): sort_param = ( "sort: [{ field: sold_date, direction: desc }]" if self.listing_type == ListingType.SOLD - else "sort: [{ field: list_date, direction: desc }]" + else "" #: "sort: [{ field: list_date, direction: desc }]" #: prioritize normal fractal sort from realtor ) pending_or_contingent_param = ( @@ -305,20 +305,15 @@ class RealtorScraper(Scraper): ) elif search_type == "area": #: general search, came from a general location query = """query Home_search( - $city: String, - $county: [String], - $state_code: String, - $postal_code: String + $location: String!, $offset: Int, ) { home_search( query: { %s - city: $city - county: $county - postal_code: $postal_code - state_code: $state_code + search_location: {location: $location} status: %s + unique: true %s %s %s @@ -444,10 +439,7 @@ class RealtorScraper(Scraper): else: #: general search, location search_variables |= { - "city": location_info.get("city"), - "county": location_info.get("county"), - "state_code": location_info.get("state_code"), - "postal_code": location_info.get("postal_code"), + "location": self.location, } if self.foreclosure: diff --git a/homeharvest/core/scrapers/realtor/queries.py b/homeharvest/core/scrapers/realtor/queries.py index 0e9de37..fb7be0e 100644 --- a/homeharvest/core/scrapers/realtor/queries.py +++ b/homeharvest/core/scrapers/realtor/queries.py @@ -220,19 +220,19 @@ HOMES_DATA = """%s }""" % _SEARCH_HOMES_DATA_BASE SEARCH_HOMES_DATA = """%s - current_estimates { - __typename - source { - __typename - type - name - } - estimate - estimateHigh: estimate_high - estimateLow: estimate_low - date - isBestHomeValue: isbest_homevalue - } +current_estimates { + __typename + source { + __typename + type + name + } + estimate + estimateHigh: estimate_high + estimateLow: estimate_low + date + isBestHomeValue: isbest_homevalue +} }""" % _SEARCH_HOMES_DATA_BASE GENERAL_RESULTS_QUERY = """{ diff --git a/pyproject.toml b/pyproject.toml index 161c55f..54e4869 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "homeharvest" -version = "0.4.6" +version = "0.4.7" description = "Real estate scraping library" authors = ["Zachary Hampton ", "Cullen Watson "] homepage = "https://github.com/Bunsly/HomeHarvest"