mirror of
https://github.com/Bunsly/HomeHarvest.git
synced 2026-03-06 04:24:29 -08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d775540afd | ||
|
|
5ea9a6f6b6 |
@@ -11,8 +11,6 @@
|
||||
- **Source**: Fetches properties directly from **Realtor.com**.
|
||||
- **Data Format**: Structures data to resemble MLS listings.
|
||||
- **Export Flexibility**: Options to save as either CSV or Excel.
|
||||
- **Usage Modes**:
|
||||
- **Python**: For those who'd like to integrate scraping into their Python scripts.
|
||||
|
||||
[Video Guide for HomeHarvest](https://youtu.be/J1qgNPgmSLI) - _updated for release v0.3.4_
|
||||
|
||||
@@ -21,7 +19,7 @@
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install homeharvest
|
||||
pip install -U homeharvest
|
||||
```
|
||||
_Python version >= [3.10](https://www.python.org/downloads/release/python-3100/) required_
|
||||
|
||||
|
||||
@@ -158,7 +158,8 @@ class RealtorScraper(Scraper):
|
||||
else None,
|
||||
address=self._parse_address(property_info, search_type="handle_listing"),
|
||||
description=Description(
|
||||
primary_photo=property_info["primary_photo"].get("href", "").replace("s.jpg", "od-w480_h360_x2.webp?w=1080&q=75"),
|
||||
primary_photo=property_info["primary_photo"].get("href", "").replace("s.jpg",
|
||||
"od-w480_h360_x2.webp?w=1080&q=75"),
|
||||
alt_photos=self.process_alt_photos(property_info.get("photos", [])),
|
||||
style=property_info["basic"].get("type", "").upper(),
|
||||
beds=property_info["basic"].get("beds"),
|
||||
@@ -385,10 +386,9 @@ class RealtorScraper(Scraper):
|
||||
listing_type = ListingType.FOR_SALE if self.listing_type == ListingType.PENDING else self.listing_type
|
||||
is_foreclosure = ""
|
||||
|
||||
if 'foreclosure' in variables and variables['foreclosure'] == True:
|
||||
if variables.get('foreclosure') is True:
|
||||
is_foreclosure = "foreclosure: true"
|
||||
|
||||
if 'foreclosure' in variables and variables['foreclosure'] == False:
|
||||
elif variables.get('foreclosure') is False:
|
||||
is_foreclosure = "foreclosure: false"
|
||||
|
||||
if search_type == "comps": #: comps search, came from an address
|
||||
@@ -578,6 +578,9 @@ class RealtorScraper(Scraper):
|
||||
return gql_results["properties"]
|
||||
|
||||
else: #: general search, comps (radius)
|
||||
if not location_info.get("centroid"):
|
||||
return []
|
||||
|
||||
coordinates = list(location_info["centroid"].values())
|
||||
search_variables |= {
|
||||
"coordinates": coordinates,
|
||||
@@ -692,7 +695,6 @@ class RealtorScraper(Scraper):
|
||||
stories=description_data.get("stories"),
|
||||
)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def calculate_days_on_mls(result: dict) -> Optional[int]:
|
||||
list_date_str = result.get("list_date")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "homeharvest"
|
||||
version = "0.3.12"
|
||||
version = "0.3.13"
|
||||
description = "Real estate scraping library"
|
||||
authors = ["Zachary Hampton <zachary@bunsly.com>", "Cullen Watson <cullen@bunsly.com>"]
|
||||
homepage = "https://github.com/Bunsly/HomeHarvest"
|
||||
|
||||
@@ -131,6 +131,15 @@ def test_realtor():
|
||||
assert all([result is not None for result in results])
|
||||
|
||||
|
||||
def test_realtor_city():
|
||||
results = scrape_property(
|
||||
location="Atlanta, GA",
|
||||
listing_type="for_sale",
|
||||
)
|
||||
|
||||
assert results is not None and len(results) > 0
|
||||
|
||||
|
||||
def test_realtor_bad_address():
|
||||
bad_results = scrape_property(
|
||||
location="abceefg ju098ot498hh9",
|
||||
|
||||
Reference in New Issue
Block a user