Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,9 +62,16 @@ if generate_button and city and preferences:
|
|
| 62 |
location = location.split(" ", 1)[1].strip()
|
| 63 |
neighborhoods.append(location)
|
| 64 |
|
| 65 |
-
# Display Zillow links
|
| 66 |
st.markdown("### Zillow Search Links")
|
| 67 |
for location in neighborhoods:
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
st.markdown(f"- [Search for homes in {location} on Zillow]({zillow_url})")
|
|
|
|
| 62 |
location = location.split(" ", 1)[1].strip()
|
| 63 |
neighborhoods.append(location)
|
| 64 |
|
| 65 |
+
# Display Zillow links, focusing on city and state first, then adding neighborhood if needed
|
| 66 |
st.markdown("### Zillow Search Links")
|
| 67 |
for location in neighborhoods:
|
| 68 |
+
# Simplify the search query to prevent Zillow from returning specific listings
|
| 69 |
+
city_state_query = urllib.parse.quote(f"{city}, {location.split(',')[-1].strip()}")
|
| 70 |
+
zillow_url = f"https://www.zillow.com/homes/{city_state_query}_rb/"
|
| 71 |
+
|
| 72 |
+
# Add neighborhood to query if broader city/state search isn't suitable
|
| 73 |
+
if city.lower() not in location.lower():
|
| 74 |
+
location_query = urllib.parse.quote(location)
|
| 75 |
+
zillow_url = f"https://www.zillow.com/homes/{location_query}_rb/"
|
| 76 |
+
|
| 77 |
st.markdown(f"- [Search for homes in {location} on Zillow]({zillow_url})")
|