feat: continue roadmap acceptance work

This commit is contained in:
ik
2026-09-20 15:17:21 +07:00
parent d438c40542
commit b0edae98c6
19 changed files with 547 additions and 50 deletions
+5 -3
View File
@@ -320,15 +320,17 @@ def main(argv: list[str] | None = None) -> int:
# Single atomic check-and-reserve before network I/O: failed attempts count toward the limit too.
check_and_reserve(site_key, state_file=args.state_file)
html = fetch_html(url)
records = (
parsed = (
parse(html, source_url=url)
if args.source in DETAIL_SOURCES or args.source == "rf4db-waterbodies"
else parse(html)
)[:args.limit]
)
records = parsed if args.source in DETAIL_SOURCES else parsed[:args.limit]
except Exception as exc:
print(f"community source failed: {exc}", file=sys.stderr)
return 1
print(json.dumps([asdict(item) for item in records], ensure_ascii=False, default=str))
payload = asdict(records) if args.source in DETAIL_SOURCES else [asdict(item) for item in records]
print(json.dumps(payload, ensure_ascii=False, default=str))
return 0