juliomalegria / python-craigslist

Simple Craigslist wrapper
MIT No Attribution
387 stars 117 forks source link

Locations, zip codes, and distance #57

Closed abwillingham closed 5 years ago

abwillingham commented 5 years ago

When specifying a location, say NewYork, and also a zip code, say 90210, and also a distance, 200 miles, how exactly is that interpreted by Craigslist since it's a condadiction? Is it 200 miles from the zip code or the location?

jbarchuk commented 5 years ago

I just did a test. I told CL to find apartments within 20 miles of Old Saybrook CT. Then I put in a keyword Orient (looking for Orient NY.) It came up with one hit. The actual distance between them is 10 miles. Driving distance is 200 through NYC, or 40 via New London Ferry. So, it's using line of sight distance. Unless it discounts the ferry. Needs another test.

juliomalegria commented 5 years ago

I tested all the combinations: i.e. query+zip_code, query+ search_distance, zip_code+ search_distance, etc. The conclusion is that "search_distance" will only be considered when used with a "zip_code". Using a location plus a distance, results in CL ignoring the distance. Using a zip_code without a distance results in CL assumming the distance is 0. When using zip_code + distance + location (query) results in CL filtering by both (so distance of zip code first, and then filtering by keyword). Hopefully that replies your question.