ok
This commit is contained in:
parent
c2070693fb
commit
909e241907
55 changed files with 594 additions and 223 deletions
|
|
@ -14,6 +14,7 @@ import polars as pl
|
|||
from constants import (
|
||||
ARCGIS_PATH,
|
||||
CHANNELS,
|
||||
NEW_HOMES_CHANNEL,
|
||||
DATA_DIR,
|
||||
DELAY_BETWEEN_OUTCODES,
|
||||
LONDON_OUTCODE_PREFIXES,
|
||||
|
|
@ -368,6 +369,34 @@ def _scrape_rightmove(
|
|||
except Exception as exc:
|
||||
_record_error(errors, "rightmove", outcode, exc)
|
||||
|
||||
# Second pass: new-build developments (mustHave=newHome). These can
|
||||
# rank low in the default resale sort, so a dedicated pass ensures
|
||||
# they are captured; transform_property stamps their URL as RES_NEW.
|
||||
# Overlap with the resale pass is removed by id in _merge_properties.
|
||||
# Skipped if a stop was requested mid-outcode (don't start a new pass).
|
||||
remaining = _source_remaining(
|
||||
results, "rightmove", max_properties_per_source
|
||||
)
|
||||
if not shutdown.stop_requested() and remaining != 0:
|
||||
try:
|
||||
new_props = rightmove_search_outcode(
|
||||
client,
|
||||
outcode_id,
|
||||
outcode,
|
||||
NEW_HOMES_CHANNEL,
|
||||
pc_index,
|
||||
max_properties=remaining,
|
||||
)
|
||||
added_new = _store_properties(
|
||||
results,
|
||||
"rightmove",
|
||||
new_props,
|
||||
max_properties_per_source,
|
||||
)
|
||||
log.info("Rightmove %s new-homes: +%d", outcode, added_new)
|
||||
except Exception as exc:
|
||||
_record_error(errors, "rightmove", outcode, exc)
|
||||
|
||||
shutdown.sleep(DELAY_BETWEEN_OUTCODES)
|
||||
finally:
|
||||
client.close()
|
||||
|
|
@ -378,7 +407,7 @@ class OutcodeTimeout(BaseException):
|
|||
|
||||
Inherits BaseException (not Exception) so the SIGALRM-triggered raise can't
|
||||
be silently swallowed by any of the broad `except Exception:` handlers
|
||||
inside zoopla.py — the signal may fire at any bytecode boundary, including
|
||||
inside zoopla.py: the signal may fire at any bytecode boundary, including
|
||||
inside those handlers."""
|
||||
|
||||
|
||||
|
|
@ -431,7 +460,7 @@ def _wall_clock_timeout(seconds: int, label: str):
|
|||
|
||||
Interrupts a hung Playwright IPC by delivering SIGALRM to the main thread;
|
||||
socket waits return EINTR and the handler raises into the caller. The
|
||||
browser is presumed unhealthy afterwards — caller must relaunch it."""
|
||||
browser is presumed unhealthy afterwards. Caller must relaunch it."""
|
||||
if seconds <= 0:
|
||||
yield
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue