
Bright Data Best Practices
Wire your agent to Bright Data’s Scraping Browser with the right connection strings, sessions, geo targeting, and bandwidth habits so SPA scraping and anti-bot flows actually work.
Overview
Bright Data Best Practices is an agent skill most often used in Build (also Idea research, Grow analytics) that documents how to use Bright Data’s Scraping Browser for reliable browser automation and anti-bot scraping.
Install
npx skills add https://github.com/brightdata/skills --skill bright-data-best-practicesWhat is this skill?
- Decision table: Browser API vs Web Unlocker, SERP API, and Web Scraper API
- Connection strings, auth, session rules, and supported automation frameworks
- Geolocation targeting, bandwidth optimization, and premium-domain notes
- CAPTCHA handling, custom CDP functions, and debugging guidance
- Documented error codes, billing model, best practices, and anti-patterns
- Covers Browser API vs Web Unlocker, SERP API, and Web Scraper API in a single decision table
- Documents session rules, geolocation targeting, bandwidth optimization, and CAPTCHA handling sections
Adoption & trust: 1.5k installs on skills.sh; 180 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need interactive browser scraping or SPA data but do not know which Bright Data product, session rules, or connection pattern to use.
Who is it for?
Solo builders automating logins, dynamic pages, or XHR capture via Bright Data with Playwright or Puppeteer.
Skip if: Simple static HTTP fetches where Web Unlocker or Web Scraper API suffice, or teams that refuse third-party scraping infrastructure.
When should I use this skill?
You need full browser automation with Bright Data (click, scroll, forms, JS, XHR) or must bypass bot checks that require a managed browser.
What do I get? / Deliverables
You get a consistent Browser API setup—auth, frameworks, geo, CAPTCHA, and cost-aware habits—so automation jobs run predictably in your agent workflow.
- Correct connection string and framework wiring for Scraping Browser
- Session, geo, and bandwidth settings aligned with billing and reliability goals
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Browser API setup is a build-time integration decision before you ship scrapers or research automations. The skill is a reference for connecting Puppeteer, Playwright, or Selenium to Bright Data—not a one-off script.
Where it fits
Map competitor pricing on a JS-heavy site before you commit to a niche.
Configure Scraping Browser auth and sessions for your agent’s nightly ingest job.
Pull metrics from a vendor dashboard that blocks simple HTTP clients.
How it compares
Vendor integration reference for managed browsers—not a generic Playwright tutorial or self-hosted proxy playbook.
Common Questions / FAQ
Who is bright-data-best-practices for?
Indie developers and agent users who scrape with Bright Data and want official Browser API patterns instead of trial-and-error configs.
When should I use bright-data-best-practices?
During Build integrations when choosing Browser API vs other Bright Data APIs; in Idea when researching competitors behind JS walls; in Grow when pulling dashboard metrics that require a real browser session.
Is bright-data-best-practices safe to install?
It is documentation-style guidance; review the Security Audits panel on this Prism page and treat API tokens as secrets with least-privilege Bright Data zones.
SKILL.md
READMESKILL.md - Bright Data Best Practices
# Browser API (Scraping Browser) Reference ## Table of Contents - [Overview](#overview) - [Authentication](#authentication) - [Connection Strings](#connection-strings) - [Supported Frameworks](#supported-frameworks) - [Session Rules](#session-rules) - [Quick Start Examples](#quick-start-examples) - [Custom CDP Functions](#custom-cdp-functions) - [Geolocation Targeting](#geolocation-targeting) - [Bandwidth Optimization](#bandwidth-optimization) - [CAPTCHA Handling](#captcha-handling) - [Debugging](#debugging) - [Premium Domains](#premium-domains) - [Error Codes](#error-codes) - [Billing Model](#billing-model) - [Best Practices](#best-practices) - [Anti-Patterns](#anti-patterns) --- ## Overview Bright Data Browser API (also called Scraping Browser) is a managed cloud browser service. It handles proxy management, fingerprinting, CAPTCHA solving, and bot detection bypass automatically. Use it when you need full browser automation: clicking, scrolling, form filling, JavaScript execution, or working with SPAs. **When to use Browser API vs other APIs:** | Need | Use | |------|-----| | Simple HTTP scraping, no interaction | Web Unlocker | | Google/Bing search results | SERP API | | Structured data from known platforms | Web Scraper API | | Click, scroll, fill forms, run JS | **Browser API** | | Intercept XHR/fetch calls from a page | **Browser API** | | Handle complex anti-bot that requires browser | **Browser API** | | Puppeteer/Playwright/Selenium automation | **Browser API** | --- ## Authentication Get credentials from your Browser API zone's **Overview tab** in the Control Panel. - **Username:** `brd-customer-{CUSTOMER_ID}-zone-{ZONE_NAME}` - **Password:** Your zone password ```bash export BROWSER_AUTH="brd-customer-CUSTOMER_ID-zone-ZONE_NAME:PASSWORD" ``` --- ## Connection Strings | Framework | Connection Type | Endpoint | |-----------|----------------|----------| | Playwright | WebSocket | `wss://${AUTH}@brd.superproxy.io:9222` | | Puppeteer | WebSocket | `wss://${AUTH}@brd.superproxy.io:9222` | | Selenium | HTTPS | `https://${AUTH}@brd.superproxy.io:9515` | Replace `${AUTH}` with `username:password`. **Critical:** Wrong port = 407 error. Playwright/Puppeteer = port `9222`. Selenium = port `9515`. --- ## Supported Frameworks - **Node.js:** Puppeteer, Playwright, Selenium WebDriver - **Python:** Playwright, Selenium - **C# (.NET):** PuppeteerSharp, Playwright, Selenium - **Other languages:** Any language with CDP or WebDriver support (Ruby, Go, Java, etc.) --- ## Session Rules - **One initial navigation per session.** After `page.goto(url)`, you can interact (click, scroll, evaluate) within the same page, but cannot navigate to a different URL in the same session. Start a new session for a new target. - **Idle timeout:** Sessions inactive for **5+ minutes** automatically close. - **Maximum duration:** Sessions cannot exceed **30 minutes**. - **Password entry:** Disabled by default to protect non-public data. Contact Bright Data to enable. --- ## Quick Start Examples ### Playwright (Node.js) ```javascript const { chromium } = require("playwright-core"); const AUTH = process.env.BROWSER_AUTH || "brd-customer-CUSTOMER_ID-zone-ZONE_NAME:PASSWORD"; const TARGET_URL = "https://example.com"; (async () => { const browser = await chromium.connectOverCDP( `wss://${AUTH}@brd.superproxy.io:9222` ); const page = await browser.newPage(); // Set navigation timeout to 2 minutes (recommended for complex unlocking) page.setDefaultNavigationTimeout(120000); await page.goto(TARGET_URL, { waitUntil: "domcontentloaded" }); const html = await page.content(); console.log(html); await browser.close(); })(); ``` ### Playwright (Python) ```python import asyncio from playwright.async_api import async_playwright AUTH = "brd-customer-CUSTOMER_ID-zone-ZONE_NAME:PASSWORD" TARGET_URL = "https://example.com" async def main(): async with async_playwright() as p: browser = await p.chromium.connec