选项
首页首页 Skill API开发 brightdata-cli

brightdata-cli

brightdata/skills brightdata/skills

使用 Bright Data CLI(`brightdata` / `bdata`)刮取网站、进行网络搜索、从 40 多个平台提取结构化数据、管理代理区域以及查看账户预算的指南。 当用户需要抓取 URL、搜索 Google/Bing/Yandex、从 Amazon/LinkedIn/Instagram/TikTok/YouTube/Reddit 或任何其他平台提取数据、查询其 Bright Data 余额或代理区域,或通过终端执行任何涉及网络数据采集的操作时,均可使用此技能。此外,当用户提及

...展开全部
76
更新时间 2026-06-29

关于brightdata-cli

Bright Data CLI 是一款命令行工具,可通过终端直接访问 Bright Data 的网络数据平台。它通过自动处理身份验证、代理管理、反机器人绕过、验证码识别以及 JavaScript 渲染,简化了网络爬取的复杂流程。 用户只需通过 OAuth 登录一次,CLI 便会无缝处理后续的所有操作,无需手动配置或管理 API 密钥。

该工具支持以多种格式(Markdown、HTML、JSON、截图)抓取任意 URL,可在 Google、Bing 和 Yandex 上进行网络搜索并获取结构化结果,还能从包括 Amazon、LinkedIn、Instagram、TikTok、YouTube 和 Reddit 在内的 40 多个平台中提取数据。 该 CLI 支持同步和异步操作,支持针对特定国家的地理定位抓取,并提供预算检查和代理区域配置等账户管理功能。所有操作均可通过“bdata scrape”或“bdata search”等简单命令完成。

该工具专为开发人员、数据分析师和研究人员设计,旨在帮助他们无需承担基础设施开销即可可靠地收集网络数据。 无论是收集竞争情报、监控内容、进行 SEO 分析,还是采集训练数据,Bright Data CLI 都能处理技术上的复杂性,同时提供直观的命令行界面。它支持 macOS、Linux 和 Windows 系统,仅需 Node.js 20+ 版本,甚至可以通过 npx 无需安装即可运行,以处理一次性任务。

常见问题

如何通过 Bright Data CLI 进行身份验证?

在浏览器中运行一次 'bdata login' 即可通过 OAuth 进行身份验证。这会将您的凭据保存在本地,并自动配置所需的代理区域。对于无头环境,请使用 'bdata login --device' 或 'bdata login --api-key' 进行非交互式身份验证。

可以从哪些平台提取数据?

该 CLI 支持通过管道从 40 多个平台提取结构化数据,包括 Amazon、LinkedIn、Instagram、TikTok、YouTube、Reddit 等。使用 'bdata pipelines list' 可查看所有可用平台类型。

抓取支持哪些输出格式?

抓取支持多种格式:Markdown(默认)、HTML、结构化数据的 JSON 以及截图图像。可通过 -f 参数指定格式,例如 'bdata scrape -f html' 或 'bdata scrape -f screenshot -o image.png'。

我需要自己管理代理或处理验证码吗?

不需要。该命令行工具会自动处理代理管理、反机器人绕过、验证码识别以及 JavaScript 渲染。在首次执行 'bdata login' 之后,所有技术上的复杂操作都将被抽象处理。

我可以从特定地理位置进行抓取吗?

可以。使用 --country 参数指定地理定位的抓取,例如 'bdata scrape https://amazon.com --country us' 即可通过美国 IP 地址进行抓取。

在 GitHub 上查看

Bright Data CLI

The Bright Data CLI (brightdata or bdata) gives you full access to Bright Data's web data platform from the terminal. It handles authentication, proxy zones, anti-bot bypass, CAPTCHA solving, and JavaScript rendering automatically — the user just needs to log in once.

Installation

If the CLI is not installed yet, guide the user:

macOS / Linux:

curl -fsSL https://cli.brightdata.com/install.sh | bash

Windows or manual install (any platform):

npm install -g @brightdata/cli

Without installing (one-off usage):

npx --yes --package @brightdata/cli brightdata <command>

Requires Node.js >= 20. After install, both brightdata and bdata (shorthand) are available.

First-Time Setup

Before anything else, check if the user is authenticated. If they haven't logged in yet, guide them through the one-time setup:

# One-time login — opens the browser for OAuth, then everything is automaticbdata login

This single command:

  1. Opens the browser for secure OAuth authentication
  2. Saves the API key locally (never needs to be entered again)
  3. Auto-creates required proxy zones (cli_unlocker, cli_browser)
  4. Sets default configuration

After login, every subsequent command works without any manual intervention.

For headless/SSH environments where no browser is available:

bdata login --device

For direct API key authentication (non-interactive):

bdata login --api-key <key>

To verify setup is complete, run:

bdata config

Command Reference

Read references/commands.md for the full command reference with all flags, options, and examples for every command.

Read references/pipelines.md for the complete list of 40+ pipeline types (Amazon, LinkedIn, Instagram, TikTok, YouTube, Reddit, and more) with their specific parameters.

Quick Command Overview

bdata is the shorthand for brightdata. Both work identically.

CommandPurpose
bdata scrape <url>Scrape any URL as markdown, HTML, JSON, or screenshot
bdata search "<query>"Search Google/Bing/Yandex with structured results
bdata pipelines <type> [params]Extract structured data from 40+ platforms
bdata pipelines listList all 40+ available pipeline types
bdata status <job-id>Check async job status
bdata zonesList proxy zones
bdata budgetView account balance and costs
bdata skill addInstall AI agent skills
bdata skill listList available skills
bdata configView/set configuration
bdata loginAuthenticate with Bright Data
bdata versionShow CLI version and system info

How to Use Each Command

Scraping

Scrape any URL with automatic bot bypass, CAPTCHA handling, and JS rendering:

# Default: returns clean markdownbdata scrape https://example.com# Get raw HTMLbdata scrape https://example.com -f html# Get structured JSONbdata scrape https://example.com -f json# Take a screenshotbdata scrape https://example.com -f screenshot -o page.png# Geo-targeted scrape from the USbdata scrape https://amazon.com --country us# Save to filebdata scrape https://example.com -o page.md# Async mode for heavy pagesbdata scrape https://example.com --async

Searching

Search engines with structured JSON output (Google returns parsed organic results, ads, People Also Ask, and related searches):

# Google search with formatted tablebdata search "web scraping best practices"# Get raw JSON for pipingbdata search "typescript tutorials" --json# Search Bingbdata search "bright data pricing" --engine bing# Localized searchbdata search "restaurants berlin" --country de --language de# News searchbdata search "AI regulation" --type news# Extract just URLsbdata search "open source tools" --json | jq -r '.organic[].link'

Pipelines (Structured Data Extraction)

Extract structured data from 40+ platforms. These trigger async jobs that poll until results are ready:

# LinkedIn profilebdata pipelines linkedin_person_profile "https://linkedin.com/in/username"# Amazon productbdata pipelines amazon_product "https://amazon.com/dp/B09V3KXJPB"# Instagram profilebdata pipelines instagram_profiles "https://instagram.com/username"# Amazon searchbdata pipelines amazon_product_search "laptop" "https://amazon.com"# YouTube comments (top 50)bdata pipelines youtube_comments "https://youtube.com/watch?v=..." 50# Google Maps reviews (last 7 days)bdata pipelines google_maps_reviews "https://maps.google.com/..." 7# Output as CSVbdata pipelines amazon_product "https://amazon.com/dp/..." --format csv -o product.csv# List all available pipeline typesbdata pipelines list

Checking Status

For async jobs (from --async scrapes or pipelines):

# Quick status checkbdata status <job-id># Wait until completebdata status <job-id> --wait# With custom timeoutbdata status <job-id> --wait --timeout 300

Budget & Zones

# Quick account balancebdata budget# Detailed balance with pending chargesbdata budget balance# All zones cost/bandwidthbdata budget zones# Specific zone costsbdata budget zone my_zone# Date range filterbdata budget zones --from 2024-01-01T00:00:00 --to 2024-02-01T00:00:00# List all zonesbdata zones# Zone detailsbdata zones info cli_unlocker

Configuration

# View all configbdata config# Set defaultsbdata config set default_zone_unlocker my_zonebdata config set default_format json

Installing AI Agent Skills

# Interactive picker — choose skills and target agentsbdata skill add# Install a specific skillbdata skill add scrape# List available skillsbdata skill list

Output Modes

Every command supports multiple output formats:

FlagEffect
(none)Human-readable formatted output with colors
--jsonCompact JSON to stdout
--prettyIndented JSON to stdout
-o <path>Write to file (format auto-detected from extension)

When piped (stdout is not a TTY), colors and spinners are automatically disabled.

Chaining Commands

The CLI is pipe-friendly:

# Search → extract first URL → scrape itbdata search "top open source projects" --json \  | jq -r '.organic[0].link' \  | xargs bdata scrape# Scrape and view with markdown readerbdata scrape https://docs.github.com | glow -# Amazon product data to CSVbdata pipelines amazon_product "https://amazon.com/dp/xxx" --format csv > product.csv

Environment Variables

These override stored configuration:

VariablePurpose
BRIGHTDATA_API_KEYAPI key (skips login entirely)
BRIGHTDATA_UNLOCKER_ZONEDefault Web Unlocker zone
BRIGHTDATA_SERP_ZONEDefault SERP zone
BRIGHTDATA_POLLING_TIMEOUTPolling timeout in seconds

Troubleshooting

ErrorFix
CLI not foundInstall with npm i -g @brightdata/cli or curl -fsSL https://cli.brightdata.com/install.sh | bash
"No Web Unlocker zone specified"bdata config set default_zone_unlocker <zone> or re-run bdata login
"Invalid or expired API key"bdata login
"Access denied"Check zone permissions in the Bright Data control panel
"Rate limit exceeded"Wait and retry, or use --async for large jobs
Async job timeoutIncrease with --timeout 1200 or BRIGHTDATA_POLLING_TIMEOUT=1200

Key Design Principles

  • One-time auth: After bdata login, everything is automatic. No tokens to manage, no keys to pass.
  • Zones auto-created: Login creates cli_unlocker and cli_browser zones automatically.
  • Smart defaults: Markdown output, auto-detected formats from file extensions, colors only in TTY.
  • Pipe-friendly: JSON output + jq for automation. Colors/spinners disabled in pipes.
  • Async support: Heavy jobs can run in background with --async + status --wait.
  • npm package: @brightdata/cli — install globally or use via npx.

安装 brightdata-cli

下载技能文件并将其解压到 .claude/skills/ 目录中。

下载ZIP

克隆仓库并复制技能文件到您的项目中。

git clone https://github.com/brightdata/skills/blob/main/skills/brightdata-cli/SKILL.md # Copy SKILL.md to your .claude/skills/ directory

复制 复制
快速设置: 将技能文件夹复制到 .claude/skills/ 目录下,Claude 会自动检测并使用该技能

相关技能

agentwallet
更新时间 2026-07-07
humanize
更新时间 2026-07-07
korean-stock-search
更新时间 2026-07-08
trello
更新时间 2026-07-01
OR