Skip to content

Enable optional web search

Slug guessing cannot derive every board identity: a Workday slug such as autodesk.wd1.Ext contains tenant, pod and site. Configure a SerpApi key to allow searchForBoards and resolution’s fallback search.

import { configureSearch, resolveCompany } from '@chrisdothtml/job-scraper';

configureSearch({
  apiKey: 'your SerpApi key',
  limit: 100,
  period: 'month',
});

await resolveCompany('Whatnot');
// { name: 'Whatnot', scraper: 'WorkdayScraper', slug: 'whatnot.wd1.Whatnot', discovered: true }

configureSearch merges partial overrides. undefined removes an override; getSearchConfig shows effective settings.

OptionDefaultPurpose
apiKeyNode environment, otherwise nullNo search without a key
limit250Searches allowed per period
period'month''day' or 'month' quota window
resultCount10Results requested for an individual search
resultTtl30 days in millisecondsReuse remembered board results, including misses
batchSize5Companies per batched query
homepagesfalseEnable homepage search by default

Node can supply:

Terminal window
SERP_API_TOKEN=... # alternatively SERPAPI_KEY or SERPAPI_API_KEY
SERPAPI_SEARCH_LIMIT=100
SERPAPI_SEARCH_PERIOD=month
SERPAPI_HOMEPAGE_SEARCH=1

Browsers have no environment-variable fallback. Choose quota settings from your own provider plan; the package defaults are not a promise of provider allowance.

Usage is persisted in search-usage.json and resets when the UTC day/month rolls over. A query is counted before its response arrives: a failed request can still consume provider quota. Once the limit is reached, new queries stop and resolution relies on earlier steps. canSearch reports key/quota availability.

Remembered board results live in search-results.json, including fruitless searches. Equivalent concurrent work shares an in-flight request. searchForBoardsBatch skips remembered companies, ORs up to batchSize names into each query, asks for up to 100 results, and attributes matching slugs back to names:

import {
  clearSearchCache,
  searchForBoardsBatch,
} from '@chrisdothtml/job-scraper';

await searchForBoardsBatch(['Klaviyo', 'Notion', 'Whatnot']); // one search
await clearSearchCache(); // start over

A result is a candidate, not proof. Resolution checks both a plausible company-name slug match and the same minJobs activity threshold as guessing before registration. A stale or unrelated search hit must not become a permanently failing registry record.

import { resolveCompany } from '@chrisdothtml/job-scraper';

await resolveCompany({ company: 'Whatnot', search: false });

clearSearchCache clears remembered board results, not quota usage. searchForHomepage returns unverified website candidates; use resolveHomepage for checked, remembered homepage results.