fix degewo
This commit is contained in:
parent
4ea437e3e6
commit
0f2f842e04
3 changed files with 39 additions and 0 deletions
|
|
@ -52,6 +52,25 @@ class DegewoHandler(BaseHandler):
|
|||
except Exception as e:
|
||||
logger.debug(f"[DEGEWO] Cookie banner dismiss failed: {e}")
|
||||
|
||||
# Save debug HTML and screenshot before checking button
|
||||
try:
|
||||
html_content = await page.content()
|
||||
html_path = DATA_DIR / f"degewo_page_{listing['id']}.html"
|
||||
with open(html_path, 'w', encoding='utf-8') as f:
|
||||
f.write(html_content)
|
||||
logger.info(f"[DEGEWO] Saved page HTML to {html_path}")
|
||||
|
||||
# Check if listing is no longer available
|
||||
if "nicht mehr verfügbar" in html_content or "Objekt nicht mehr verfügbar" in html_content:
|
||||
logger.warning(f"[DEGEWO] Listing no longer available")
|
||||
result["success"] = False
|
||||
result["message"] = "Listing no longer available"
|
||||
result["deactivated"] = True
|
||||
await page.close()
|
||||
return result
|
||||
except Exception as e:
|
||||
logger.warning(f"[DEGEWO] Could not save HTML: {e}")
|
||||
|
||||
logger.info("[DEGEWO] Looking for kontaktieren button...")
|
||||
apply_btn = await page.query_selector('a:has-text("kontaktieren"), button:has-text("kontaktieren"), a:has-text("Kontaktieren"), button:has-text("Kontaktieren")')
|
||||
if apply_btn and await apply_btn.is_visible():
|
||||
|
|
|
|||
|
|
@ -72,6 +72,14 @@ class GewobagHandler(BaseHandler):
|
|||
html_content = await iframe_page.content()
|
||||
with open(DATA_DIR / f"gewobag_wohnungshelden_{listing['id']}.html", "w", encoding="utf-8") as f:
|
||||
f.write(html_content)
|
||||
|
||||
# Check for Wohnungshelden error messages
|
||||
if "Fehler beim Laden" in html_content or "Beim Laden der Gesuchsdaten ist ein Fehler aufgetreten" in html_content:
|
||||
logger.warning("[GEWOBAG] Wohnungshelden iframe shows error - may be transient, will retry")
|
||||
result["success"] = False
|
||||
result["message"] = "Wohnungshelden application form error - will retry later"
|
||||
await iframe_page.close()
|
||||
return result
|
||||
except Exception as e:
|
||||
logger.warning(f"[GEWOBAG] Could not save HTML: {e}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue