fix session expired and try variant timing
This commit is contained in:
parent
867c6f3152
commit
b4e84e430e
6 changed files with 211 additions and 9 deletions
|
|
@ -699,9 +699,11 @@ Total listings tracked: {total_listings}
|
|||
|
||||
# Attempt login if not already logged in
|
||||
if not self.state_manager.logged_in:
|
||||
logger.info("Not logged in - attempting login")
|
||||
login_success = await self.login(page)
|
||||
if login_success:
|
||||
self.state_manager.logged_in = True
|
||||
logger.info("Login successful - session established")
|
||||
else:
|
||||
logger.warning("Login failed. Proceeding with public listings.")
|
||||
|
||||
|
|
@ -752,6 +754,10 @@ Total listings tracked: {total_listings}
|
|||
logger.info(f"Collected content from {page_num} page(s)")
|
||||
content = all_content
|
||||
|
||||
# Session validation: if logged in but only got 1 page, session may be expired
|
||||
if self.state_manager.logged_in and page_num == 1:
|
||||
logger.warning("Logged in but only 1 page fetched - possible session expiration")
|
||||
|
||||
# Debug: save HTML to file for inspection
|
||||
debug_path = DATA_DIR / "debug_page.html"
|
||||
with open(debug_path, "w", encoding="utf-8") as f:
|
||||
|
|
@ -827,6 +833,9 @@ Total listings tracked: {total_listings}
|
|||
|
||||
if not listings:
|
||||
logger.warning("No listings parsed")
|
||||
# Additional check: if we have deeplinks but no parsed listings, something went wrong
|
||||
if len(id_to_link) > 0:
|
||||
logger.warning(f"Found {len(id_to_link)} deeplinks but parsed 0 listings - extraction issue")
|
||||
|
||||
await page.close()
|
||||
logger.info(f"Fetched {len(listings)} listings")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue