Skip to main content
Version: Next

IRenderingTypePredictor

experimental

Minimal contract that any object passed to AdaptivePlaywrightCrawler as its renderingTypePredictor option must satisfy.

Implemented by

Index

Methods

predict

  • predict(request): Awaitable<{ detectionProbabilityRecommendation: number; renderingType: RenderingType }>
  • experimental

    Predict the rendering type for a request, and how likely the crawler should be to verify it.

    Called once per request, before navigation - the crawler awaits it, so prefer loading whatever the prediction needs up front over per-request I/O.


    Parameters

    Returns Awaitable<{ detectionProbabilityRecommendation: number; renderingType: RenderingType }>

storeResult

  • storeResult(requests, renderingType): Awaitable<void>
  • experimental

    Report a detected rendering type, so that future predictions can take it into account.

    The crawler does not await this per detection - it collects the returned promises and drains them in teardown(), so an implementation that persists results asynchronously can keep batching its writes and still be sure they land before the crawl ends.


    Parameters

    Returns Awaitable<void>

Page Options