File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -290,12 +290,29 @@ class SnapshotDiagnosticsMetrics(BaseModel):
290290 raw_elements_count : int | None = None
291291
292292
293+ class CaptchaEvidence (BaseModel ):
294+ text_hits : list [str ] = Field (default_factory = list )
295+ selector_hits : list [str ] = Field (default_factory = list )
296+ iframe_src_hits : list [str ] = Field (default_factory = list )
297+ url_hits : list [str ] = Field (default_factory = list )
298+
299+
300+ class CaptchaDiagnostics (BaseModel ):
301+ """Detection-only CAPTCHA signal (no solving/bypass)."""
302+
303+ detected : bool = False
304+ provider_hint : str | None = None
305+ confidence : float = 0.0
306+ evidence : CaptchaEvidence = Field (default_factory = CaptchaEvidence )
307+
308+
293309class SnapshotDiagnostics (BaseModel ):
294310 """Runtime stability/debug information (reserved for diagnostics, not ML metadata)."""
295311
296312 confidence : float | None = None
297- reasons : list [str ] = []
313+ reasons : list [str ] = Field ( default_factory = list )
298314 metrics : SnapshotDiagnosticsMetrics | None = None
315+ captcha : CaptchaDiagnostics | None = None
299316
300317 def get_grid_bounds (self , grid_id : int | None = None ) -> list [GridInfo ]:
301318 """
Original file line number Diff line number Diff line change @@ -103,10 +103,17 @@ def _build_snapshot_payload(
103103 """
104104 diagnostics = raw_result .get ("diagnostics" ) or {}
105105 client_metrics = None
106+ client_diagnostics = None
106107 try :
107108 client_metrics = diagnostics .get ("metrics" )
108109 except Exception :
109110 client_metrics = None
111+ try :
112+ captcha = diagnostics .get ("captcha" )
113+ if captcha is not None :
114+ client_diagnostics = {"captcha" : captcha }
115+ except Exception :
116+ client_diagnostics = None
110117
111118 return {
112119 "raw_elements" : raw_result .get ("raw_elements" , []),
@@ -118,6 +125,7 @@ def _build_snapshot_payload(
118125 "filter" : options .filter .model_dump () if options .filter else None ,
119126 },
120127 "client_metrics" : client_metrics ,
128+ "client_diagnostics" : client_diagnostics ,
121129 }
122130
123131
You can’t perform that action at this time.
0 commit comments