INNER CODE UNIT · Python
scan_username
OpenOSINT/OpenOSINT · actors/username-recon/src/main.py:139
async def scan_username(username: str, chunks: list[dict], run_deadline: float) -> tuple[list[dict], bool, int]:
"""
Scan username across all chunks, stopping early if the run budget is spent.
Returns (hits, had_any_successful_chunk, skipped_site_count).
had_any_successful_chunk is False only when every chunk failed — that's a
genuine scan failure, not "zero accounts found", and callers should treat
it differently. skipped_site_count covers both chunks that errored out
and chunks never attempted because the run deadline hit first — either
way, those sites were never actually checked for this username.
"""
hits: list[dict] = []
had_success = False
skipped_sites = 0
for i, chunk in enumerate(chunks):
if time.monotonic() > run_deadline:
skipped_sites += sum(len(c) for c in chunks[i:])
break