brightdata-sdk-js
Web data extraction and discovery using the Bright Data JavaScript/TypeScript SDK (`@brightdata/sdk`). Use when the user is working in Node.js/TypeScript and asks to "scrape", "get data from", "extract", "search for", or "find" information from websites. Also use when the user mentions specific platforms like Amazon, LinkedIn, Instagram, Facebook, TikTok, YouTube, Reddit, Pinterest, ChatGPT, Perplexity, or DigiKey, or asks for "bulk data", "historical data", or "dataset" from JS. Covers scraping, SERP search, AI discovery, datasets, browser automation, and Scraper Studio. For Python, use brightdata-sdk; for the terminal CLI, use brightdata-cli.
What this skill does
# Bright Data JavaScript SDK
Access web data through a unified Node.js/TypeScript SDK (`@brightdata/sdk`). One
client, several services: web unlocking (`scrapeUrl`), platform scraping
(`scrape.<platform>`), SERP search (`search.google/bing/yandex`), AI discovery
(`discover`), datasets, browser automation, and Scraper Studio.
**Requires Node.js ≥ 20.** Ships ESM + CommonJS with full TypeScript types. The
client is exported as `bdclient` (lowercase — not a typo).
## Setup gate (do first)
```bash
npm install @brightdata/sdk # or: pnpm add / yarn add
```
The client reads the `BRIGHTDATA_API_TOKEN` env var, or you pass `{ apiKey }`.
Get a token at https://brightdata.com/cp/setting/users.
```javascript
// ESM (package.json "type": "module", or .mjs)
import { bdclient } from '@brightdata/sdk';
// CommonJS (.cjs / "type": "commonjs")
const { bdclient } = require('@brightdata/sdk');
const client = new bdclient(); // reads BRIGHTDATA_API_TOKEN
// const client = new bdclient({ apiKey: '...' });
try {
const html = await client.scrapeUrl('https://example.com');
} finally {
await client.close(); // always close (or `await using`)
}
```
`await using client = new bdclient()` (TS 5.2+ / Node ≥20) auto-closes at scope end.
## Service Selection (decide first, then look up the method)
Pick the service BEFORE reaching for a specific method. Most routing mistakes
come from skipping this step and pattern-matching on keywords.
```
Have a URL?
├── On a supported platform (Amazon, LinkedIn, Facebook, Instagram, YouTube,
│ TikTok, Reddit, Pinterest, ChatGPT, Perplexity, DigiKey)?
│ → Platform scraping: client.scrape.<platform>.<method>(urls, opts?)
│
├── Generic page (no dedicated platform scraper)?
│ → Web unlocker: client.scrapeUrl(url, { dataFormat: 'markdown' })
│
└── Need login / JS / click-scroll-fill / CAPTCHA / multi-step nav?
→ Browser API: client.browser.getConnectUrl() (connect via Playwright)
No URL?
├── Want entities matching natural-language criteria
│ ("find AI startups in Berlin", "competitors of Acme")?
│ → Discover: client.discover(query, { intent })
│
├── Want web pages / search-result links ("search Google for X")?
│ → SERP: client.search.google(query) [or .bing / .yandex]
│
├── Want to search WITHIN a platform ("Amazon products by keyword",
│ "LinkedIn jobs", "Instagram reels by profile")?
│ → Platform discovery: client.scrape.<platform>.discover*(filters)
│ or amazon.productSearch(...) (NOTE: client.search is SERP-only here)
│
└── Want bulk/historical data at scale?
→ Datasets: client.datasets.<name>.query(filter) → .download(snapshotId)
```
Edge cases:
- Supported-platform URL BUT user mentions login/click/scroll/JS → Browser API (the interaction trumps the platform).
- Supported-platform scrape returns 403/blocked → fall back to `client.scrapeUrl()` (web unlocker).
- "Find/research who are X" with a URL alongside ("competitors of acme.com") → still Discover; the URL is context, not the scrape target.
## ⚠️ Key differences from the Python SDK
If you know the Python SDK (`brightdata-sdk`), the JS surface differs — do not
port names blindly:
| Concept | Python | JavaScript |
|---|---|---|
| Client | `SyncBrightDataClient` / `BrightDataClient` | `bdclient` (single, all async) |
| Web unlocker | `client.scrape_url(url=...)` | `client.scrapeUrl(url, opts)` |
| Platform search | `client.search.amazon.products(...)` | **none** — use `scrape.amazon.productSearch` / `discover*` |
| `client.search` | SERP **and** platform search | **SERP only** (google/bing/yandex) |
| Batch | `*_trigger` methods + `job.wait()` | pass a `string[]` to one call, or `*Trigger` + `job.wait()` |
| Naming | `snake_case` | `camelCase` |
| Datasets | `client.datasets.amazon_products` | `client.datasets.amazonProducts` |
## Method Names: Verify Before Asserting
Before claiming a platform method exists/doesn't exist, **consult
`references/scrapers.md`** — it lists every platform's verified methods. The SDK
ships TypeScript types, so in a typed project you can also let the compiler/editor
confirm a method exists.
Each platform exposes up to three method styles (see `references/scrapers.md`):
- **`collect<Thing>(input, opts?)`** — returns the rows directly (`object[]`).
- **`<thing>(input, opts?)`** — orchestrated (trigger → poll → download); returns `{ data, status, rowCount }`. **Default to this.**
- **`discover<Thing>By<X>(filters, opts?)`** — find items by keyword/category/URL filter instead of by direct URL.
**Likely hallucinations** (do NOT write these — verify in `references/scrapers.md`):
| Wrong | Right |
|---|---|
| `client.search.amazon.products(...)` | `client.scrape.amazon.productSearch(...)` (no platform search router in JS) |
| `client.scrape.linkedin.people(...)` | `client.scrape.linkedin.profiles(urls)` |
| `client.scrape.chatgpt...` | `client.scrape.chatGPT...` (camelCase G+T) |
| `client.datasets.amazon_products` | `client.datasets.amazonProducts` |
| `BrightDataClient` / `new BdClient()` | `bdclient` (all lowercase) |
## Useful standalone methods
| Method | What it does |
|---|---|
| `client.scrapeUrl(url \| url[], opts?)` | Web unlocker — any URL → html / markdown / json / screenshot. Pass an array for parallel batch. |
| `client.search.google(q \| q[], opts?)` | SERP results (also `.bing`, `.yandex`). Array = batch. |
| `client.discover(query, { intent })` | AI-ranked entity/page discovery. |
| `client.discoverTrigger(query, opts?)` | Non-blocking discover → `Job` with `.wait()` / `.fetch()`. |
| `client.datasets.list()` | List all available datasets at runtime. |
| `client.scraperStudio.run(collectorId, { input })` | Run a custom Scraper Studio collector. |
| `client.browser.getConnectUrl({ country })` | CDP WebSocket URL for Playwright/Puppeteer/Selenium. |
| `client.listZones()` | List active Bright Data zones. |
| `client.saveResults(data, { filename, format })` | Write results to a file. |
| `client.close()` | Close HTTP connections. Always call when done. |
## Gotchas
- **Always `await client.close()`** (or `await using`). The client holds a keep-alive transport; leaking it hangs the process.
- **`client.search` is SERP-only** (google/bing/yandex). To search *within* a platform, use that platform's `discover*` / `productSearch` scraper methods — there is no `client.search.amazon`.
- **`chatGPT` is camelCase** on `client.scrape` — `client.scrape.chatGPT.search(...)`, not `.chatgpt`.
- **Batch: pass an array, don't loop.** `scrapeUrl([...urls])` and `search.google([...queries])` run in parallel internally. For platform scrapers with many inputs, prefer the orchestrated method with an array, or the `*Trigger` + `job.wait()` pattern (see `references/advanced.md`). Don't wrap blocking calls in `Promise.all` of single-item calls — you'll fight the rate limiter.
- **Orchestrated methods block for minutes.** `products`/`profiles`/etc. trigger a job and poll until ready (often 2–10 min). Don't set tiny `pollTimeout`s; tune via `{ pollInterval, pollTimeout }`. Defaults are calibrated.
- **Datasets are historical/bulk, not live.** Need current data → use platform scrapers or `scrapeUrl`. `query()` returns a `snapshotId`; `download()` blocks until the snapshot is ready.
- **Web unlocker fallback on 403.** If a platform scraper is blocked, retry the URL through `client.scrapeUrl()`.
- **Don't add your own retry loop.** The transport already retries network/timeout errors with backoff; double-retrying wastes credits. Tune `timeout` / `rateLimit` on the constructor instead.
- **Cost hierarchy (cheapest first):** datasets → SERP → platform scrapers → web unlocker → discover → Scraper Studio → Browser API. Prefer the cheapest service that satisfies the request.
## Error handling
All errors extend `BRDError`. Import the specific classes to branch:
```javascript
import { bdclient, ValidationError, AuthenticationError, BRDErrRelated in Ads & Marketing
ads
IncludedMulti-platform paid advertising audit and optimization skill. Analyzes Google, Meta, YouTube, LinkedIn, TikTok, Microsoft, and Apple Ads. 250+ checks with scoring, parallel agents, industry templates, and AI creative generation.
banana
IncludedAI image generation Creative Director powered by Google Gemini Nano Banana models. Use this skill for ANY request involving image creation, editing, visual asset production, or creative direction. Triggers on: generate an image, create a photo, edit this picture, design a logo, make a banner, visual for my anything, and all /banana commands. Handles text-to-image, image editing, multi-turn creative sessions, batch workflows, and brand presets.
rpg-migration-analyzer
IncludedAnalyzes legacy RPG (Report Program Generator) programs from AS/400 and IBM i systems for migration to modern Java applications. Extracts business logic from RPG III/IV/ILE source code, identifies data structures (D-specs), file operations (F-specs), program dependencies (CALLB/CALLP), and converts RPG constructs to Java equivalents. Generates migration reports, complexity estimates, and Java implementation strategies with POJO classes, JPA entities, and service methods. Use when modernizing AS/400 or IBM i legacy systems, analyzing RPG source files (.rpg, .rpgle, .RPGLE), converting RPG to Java, mapping data specifications to Java classes, planning legacy system migration, or when user mentions RPG analysis, Report Program Generator, RPG III/IV/ILE, AS/400 modernization, IBM i migration, packed decimal conversion, or mainframe application rewrite.
brand-library-architect
IncludedBuild a complete brand library for a product — visual asset render pipeline, brand documentation set (BRAND, COPY, MANIFESTO, BIOS, FAQ, GLOSSARY, TONE, PRICING), open-source convention files (README, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT), and a self-contained press kit. This skill should be used when the user asks to "build a brand library / brand kit / press kit / brand assets" for a product, "set up a brand library workflow," "create a positioning manifesto plus visual identity," or any combination of brand documentation + visual asset pipeline. Apply phase-by-phase or run end-to-end. Templates are product-agnostic and use {{TOKEN}} placeholders the skill prompts the user to fill.
writing-tech-post
IncludedAuthors engineering blog posts end-to-end: launch deep-dives, incident postmortems, architecture migrations, performance case studies, tutorials, AI/agent system writeups, security disclosures, and research-to-product translations. Picks the correct archetype, plans the abstraction ladder, enforces an evidence cadence (diagrams, benchmarks, profiles, traces, code, ablations), tunes voice against publisher house styles (Datadog, Vercel, GitHub, AWS, Meta, Cloudflare, Jane Street), and runs a pre-publish gate for narrative momentum and disclosure ethics. Use when drafting a new engineering post, restructuring a draft that feels flat, deciding which evidence form belongs where, validating that depth and product context are balanced, or preparing a postmortem, migration, or performance narrative for external publication. Do not use for API reference documentation, README authoring, marketing copy, release notes, generic SEO content, ghost-written executive thought leadership, or non-engineering long-form essays.
blog-google
IncludedGoogle API integration for blog performance: PageSpeed Insights, CrUX Core Web Vitals with 25-week history, Search Console performance, URL Inspection, Indexing API, GA4 organic traffic, NLP entity analysis for E-E-A-T, YouTube video search for embedding, and Google Ads Keyword Planner. Progressive feature availability based on credential tier (API key, OAuth/service account, GA4, Ads). Shares config with claude-seo at ~/.config/claude-seo/google-api.json. Use when user says "google data", "page speed", "core web vitals", "search console", "indexation", "GA4", "keyword research", "nlp entities", "blog performance", "youtube search", "google api setup".