Update app.py
Browse files
app.py
CHANGED
|
@@ -54,6 +54,13 @@ def scrape_website(url, max_pages=5):
|
|
| 54 |
|
| 55 |
return " ".join(all_content[:3000]), scrape_successful
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
def infer_business_info_from_url(url):
|
| 58 |
"""
|
| 59 |
Infer business details from the domain name.
|
|
|
|
| 54 |
|
| 55 |
return " ".join(all_content[:3000]), scrape_successful
|
| 56 |
|
| 57 |
+
def extract_location(content):
|
| 58 |
+
"""
|
| 59 |
+
Extract a possible location from the website content using regular expressions.
|
| 60 |
+
"""
|
| 61 |
+
location_match = re.search(r'\b(?:serving|located in|offices in|based in)\s([\w\s,]+)', content, re.IGNORECASE)
|
| 62 |
+
return location_match.group(1).strip() if location_match else None
|
| 63 |
+
|
| 64 |
def infer_business_info_from_url(url):
|
| 65 |
"""
|
| 66 |
Infer business details from the domain name.
|