Update app.py
Browse files
app.py
CHANGED
|
@@ -307,26 +307,26 @@ def generate_email(name, email, prospect_name, linkedin_url, website_url, contex
|
|
| 307 |
website_sitemap_url = urljoin(website_url, "sitemap_index.xml")
|
| 308 |
website_content = safe_extract_content(website_url)
|
| 309 |
if not website_content:
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
context_content = extract_content(context_url) if context_url else ""
|
| 318 |
|
| 319 |
# Fetch details from the company website
|
| 320 |
company_sitemap_url = urljoin(company_url, "sitemap_index.xml")
|
| 321 |
company_content = safe_extract_content(company_url)
|
| 322 |
if not company_content:
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
|
| 331 |
# Construct the purpose-specific prompt
|
| 332 |
if email_purpose == "Job Application":
|
|
|
|
| 307 |
website_sitemap_url = urljoin(website_url, "sitemap_index.xml")
|
| 308 |
website_content = safe_extract_content(website_url)
|
| 309 |
if not website_content:
|
| 310 |
+
# If direct scraping fails, fall back to the sitemap
|
| 311 |
+
website_urls = parse_sitemap(website_sitemap_url)
|
| 312 |
+
if isinstance(urls, list):
|
| 313 |
+
for url in urls:
|
| 314 |
+
website_content = safe_extract_content(url)
|
| 315 |
+
if website_content:
|
| 316 |
+
break
|
| 317 |
context_content = extract_content(context_url) if context_url else ""
|
| 318 |
|
| 319 |
# Fetch details from the company website
|
| 320 |
company_sitemap_url = urljoin(company_url, "sitemap_index.xml")
|
| 321 |
company_content = safe_extract_content(company_url)
|
| 322 |
if not company_content:
|
| 323 |
+
# If direct scraping fails, fall back to the sitemap
|
| 324 |
+
company_urls = parse_sitemap(company_sitemap_url)
|
| 325 |
+
if isinstance(urls, list):
|
| 326 |
+
for url in urls:
|
| 327 |
+
company_content = safe_extract_content(url)
|
| 328 |
+
if company_content:
|
| 329 |
+
break
|
| 330 |
|
| 331 |
# Construct the purpose-specific prompt
|
| 332 |
if email_purpose == "Job Application":
|