Skip to content
1 min read · 172 words

Function: createScrapperArticleTool()

ts
function createScrapperArticleTool(
  config: ScrapperArticleConfig,
): Promise<Tool<SpooledArtifact>>;

Defined in: batteries/tools/scrapper/index.ts:365

Create a configured Scrapper article Tool (async — accepts a dynamic-import artifact).

Parameters

ParameterTypeDescription
configScrapperArticleConfigInstance URL, instance-auth headers, output policy, artifact resolver, per-parameter disposition (fixed/defaults/fixedQuery), and middleware pipelines.

Returns

Promise<Tool<SpooledArtifact>>

A promise of a Tool ready to register in a ToolRegistry.

Remarks

Async because artifact may be an async / dynamic-import resolver, which must resolve to the sync () => Ctor Tool.artifactConstructor requires before the tool is built. For the common case, use createScrapperArticleToolSync and skip the await.

WARNING

Two distinct "headers": config.headers authenticates to the Scrapper instance; the extra_http_headers parameter is what the scraper's browser sends to the target site — do not conflate them. Also note scroll_down requires a positive sleep, and resultUri/screenshotUri are instance-relative and may come back http:// even over HTTPS — do not assume they match instanceUrl.

Throws

E_INVALID_SCRAPPER_CONFIG when instanceUrl or artifact is invalid.