Skip to Content
searchSDK

Contents

Fetch the readable text of web pages through a provider, one result per requested URL, with failures kept.

contents(urls, options) returns one page per requested URL, in order.

import { contents } from "@searchsdk/sdk";

const { pages, cost } = await contents(["https://example.com/a", "https://example.com/b"], { provider: "exa" });
for (const page of pages) {
  if (page.status === "ok") console.log(page.title, page.content?.length);
  else console.log(page.url, page.error?.code);
}
console.log(cost.usd);

Options

The call options from Search: provider, fallback, providerOptions, timeoutMs, attemptTimeoutMs, maxRetries, maxResponseBytes and signal. Each provider takes a limited number of URLs per call; its page says how many.

Pages

FieldMeaning
urlThe URL as requested
statusok or failed
finalUrlAddress after redirects, or null
title, author, publishedAtOr null
contentPage text, Markdown or plain per provider
errorCode and message for a failed page

A URL the provider did not return is failed with code missing. One failed page does not fail the call.

On this page