選項
首頁首頁 Skill API開發 brightdata-cli

brightdata-cli

brightdata/skills brightdata/skills

使用 Bright Data CLI(`brightdata` / `bdata`)進行網站抓取、網路搜尋、從 40 多個平台擷取結構化資料、管理代理伺服器區域以及查詢帳戶預算的指南。 當使用者希望抓取網址、搜尋 Google/Bing/Yandex、從 Amazon/LinkedIn/Instagram/TikTok/YouTube/Reddit 或任何其他平台擷取資料、查詢其 Bright Data 餘額或代理伺服器區域,或透過終端機執行任何涉及網路資料收集的操作時,皆可使用此技能。此外,當使用者提及

...展開全部
78
更新時間 2026-06-29

關於brightdata-cli

Bright Data CLI 是一款命令列工具,可讓使用者透過終端機直接存取 Bright Data 的網路資料平台。它能自動處理認證、代理伺服器管理、避開反機器人機制、破解 CAPTCHA 以及 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」。

我需要自行管理代理伺服器或處理 CAPTCHA 嗎?

不需要。命令列介面(CLI)會自動處理代理伺服器管理、防機器人機制繞過、驗證碼解讀以及 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 會自動偵測並使用該技能
儲存庫 brightdata/skills

相關技能

agentwallet
更新時間 2026-07-07
humanize
更新時間 2026-07-07
korean-stock-search
更新時間 2026-07-08
trello
更新時間 2026-07-01
OR