-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05fca9b
commit 49d2794
Showing
5 changed files
with
91 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import argparse | ||
import datetime | ||
from homeharvest import scrape_property | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description="Home Harvest Property Scraper") | ||
parser.add_argument( | ||
"location", type=str, help="Location to scrape (e.g., San Francisco, CA)" | ||
) | ||
parser.add_argument( | ||
"--site_name", | ||
type=str, | ||
nargs="*", | ||
default=None, | ||
help="Site name(s) to scrape from (e.g., realtor.com zillow)", | ||
) | ||
parser.add_argument( | ||
"--listing_type", | ||
type=str, | ||
default="for_sale", | ||
choices=["for_sale", "for_rent", "sold"], | ||
help="Listing type to scrape", | ||
) | ||
parser.add_argument( | ||
"--output", | ||
type=str, | ||
default="excel", | ||
choices=["excel", "csv"], | ||
help="Output format", | ||
) | ||
parser.add_argument( | ||
"--filename", | ||
type=str, | ||
default=None, | ||
help="Name of the output file (without extension)", | ||
) | ||
|
||
args = parser.parse_args() | ||
result = scrape_property(args.location, args.site_name, args.listing_type) | ||
|
||
if not args.filename: | ||
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") | ||
args.filename = f"HomeHarvest_{timestamp}" | ||
|
||
if args.output == "excel": | ||
output_filename = f"{args.filename}.xlsx" | ||
result.to_excel(output_filename, index=False) | ||
print(f"Excel file saved as {output_filename}") | ||
elif args.output == "csv": | ||
output_filename = f"{args.filename}.csv" | ||
result.to_csv(output_filename, index=False) | ||
print(f"CSV file saved as {output_filename}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
[tool.poetry] | ||
name = "homeharvest" | ||
version = "0.2.2" | ||
version = "0.2.3" | ||
description = "Real estate scraping library supporting Zillow, Realtor.com & Redfin." | ||
authors = ["Zachary Hampton <[email protected]>", "Cullen Watson <[email protected]>"] | ||
homepage = "https://github.com/ZacharyHampton/HomeHarvest" | ||
readme = "README.md" | ||
|
||
[tool.poetry.scripts] | ||
homeharvest = "homeharvest.cli:main" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
requests = "^2.31.0" | ||
|
@@ -18,4 +21,4 @@ pytest = "^7.4.2" | |
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
build-backend = "poetry.core.masonry.api" |