Skip to content

Add a flag to disable page-type classification (dit model download) when using -json/-csv #2543

Description

@jalilm

httpx version:
v1.10.0

Current Behavior:
Passing -json (or -csv/-fpt) unconditionally initializes the dit page-type classifier (runner.go, if options.JSONOutput || options.CSVOutput || len(options.OutputFilterPageType) > 0 { dit.New() }). On a machine with no cached model, dit.New() downloads a ~92 MB model.json from Hugging Face (ModelURL in happyhackingspace/dit), logging INFO Model downloaded size=92.6MB to stderr.

There is no flag or env var to opt out.

Expected Behavior:
A flag (e.g. -no-classify) to use -json/-csv output without page-type classification, leaving ditClassifier unset classifyPage already early-returns when r.ditClassifier == nil, so it looks like a one-line guard.

Steps To Reproduce:

  1. Remove any cached model: rm -rf ~/.dit
  2. Run: echo https://example.com | httpx -json
  3. Observe httpx downloads the ~92 MB model and logs Model downloaded size=... — with no way to disable it.

Anything else:
We consume only core JSON fields (not page_type/forms), but must pass -json to parse output, which forces the classifier and its model download.
Workaround is pre-seeding ~/.dit/model.json (even {}), but an opt-out flag would be cleaner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions