跳到正文
Skillpedia
网页抓取33k · #9095

bright-data-best-practices

它能做什么

这项技能为你的智能体提供 Bright Data 网页数据 API 的参考指导。适合开发抓取、搜索或浏览器自动化功能的开发人员。

适用场景

  • ✓正在开发需要稳定地从大量网页获取内容的功能的时候。
  • ✓需要以结构化数据形式获取 Google、Bing 或 Yandex 搜索结果的时候。
  • ✓想用浏览器 API 自动完成网站上的点击、滚动或表单操作的时候。

技能链接

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/web-data/bright-data-best-practices/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/web-data/bright-data-best-practices/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我应该用哪个 Bright Data API,把 Google 搜索结果接入我的应用?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体把你的使用场景对应到合适的 Bright Data API,然后帮你设置身份验证和相应代码。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Bright Data APIs

Bright Data provides infrastructure for web data extraction at scale. Four primary APIs cover different use cases — always pick the most specific tool for the job.

Choosing the Right API

Use Case API Why
Scrape any webpage by URL (no interaction) Web Unlocker HTTP-based, auto-bypasses bot detection, cheapest
Google / Bing / Yandex search results SERP API Specialized for SERP extraction, returns structured data
Structured data from Amazon, LinkedIn, Instagram, TikTok, etc. Web Scraper API Pre-built scrapers, no parsing needed
Click, scroll, fill forms, run JS, intercept XHR Browser API Full browser automation
Puppeteer / Playwright / Selenium automation Browser API Connects via CDP/WebDriver

Authentication Pattern (All APIs)

All APIs share the same authentication model:

export BRIGHTDATA_API_KEY="your-api-key"         # From Control Panel > Account Settings
export BRIGHTDATA_UNLOCKER_ZONE="zone-name"       # Web Unlocker zone name
export BRIGHTDATA_SERP_ZONE="serp-zone-name"      # SERP API zone name
export BROWSER_AUTH="brd-customer-ID-zone-NAME:PASSWORD"  # Browser API credentials

REST API authentication header for Web Unlocker and SERP API:

Authorization: Bearer YOUR_API_KEY

Web Unlocker API

HTTP-based scraping proxy. Best for simple page fetches without browser interaction.

Endpoint: POST https://api.brightdata.com/request

import requests

response = requests.post(
    "https://api.brightdata.com/request",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "zone": "YOUR_ZONE_NAME",
        "url": "https://example.com/product/123",
        "format": "raw"
    }
)
html = response.text

Key Parameters

Parameter Type Description
zone string Zone name (required)
url string Target URL with http:// or https:// (required)
format string "raw" (HTML) or "json" (structured wrapper) (required)
method string HTTP verb, default "GET"
country string 2-letter ISO for geo-targeting (e.g., "us", "de")
data_format string Transform: "markdown" or "screenshot"
async boolean true for async mode

Quick Patterns

# Get markdown (best for LLM input)
response = requests.post(
    "https://api.brightdata.com/request",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"zone": ZONE, "url": url, "format": "raw", "data_format": "markdown"}
)

# Geo-targeted request
json={"zone": ZONE, "url": url, "format": "raw", "country": "de"}

# Screenshot for debugging
json={"zone": ZONE, "url": url, "format": "raw", "data_format": "screenshot"}

# Async for bulk processing
json={"zone": ZONE, "url": url, "format": "raw", "async": True}

Critical rule: Never use Web Unlocker with Puppeteer, Playwright, Selenium, or anti-detect browsers. Use Browser API instead.

See references/web-unlocker.md for complete reference including proxy interface, special headers, async flow, features, and billing.


SERP API

Structured search engine result extraction for Google, Bing, Yandex, DuckDuckGo.

Endpoint: POST https://api.brightdata.com/request (same as Web Unlocker)

response = requests.post(
    "https://api.brightdata.com/request",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "zone": "YOUR_SERP_ZONE",
        "url": "https://www.google.com/search?q=python+web+scraping&brd_json=1&gl=us&hl=en",
        "format": "raw"
    }
)
data = response.json()
for result in data.get("organic", []):
    print(result["rank"], result["title"], result["link"])

Essential Google URL Parameters

Parameter Description Example
q Search query q=python+web+scraping
brd_json Parsed JSON output brd_json=1 (always use for data pipelines)
gl Country for search gl=us
hl Language hl=en
start Pagination offset start=10 (page 2), start=20 (page 3)
tbm Search type tbm=nws (news), tbm=isch (images), tbm=vid (videos)
brd_mobile Device brd_mobile=1 (mobile), brd_mobile=ios
brd_browser Browser brd_browser=chrome
brd_ai_overview Trigger AI Overview brd_ai_overview=2
uule Encoded geo location for precise
常见问题

涵盖哪些 Bright Data API?

涵盖 Web Unlocker、SERP、Web Scraper 和 Browser API。

需要设置什么?

需要 Bright Data API 密钥和区域(zone)名称,二者以环境变量形式设置。

它能帮助选择工具吗?

能。该技能中的表格将每种使用场景对应到最合适的 API。

详情

作者的原始描述

Build production-ready Bright Data integrations with best practices baked in. Reference documentation for developers using coding assistants (Claude Code, Cursor, etc.) to implement web scraping, search, browser automation, and structured data extraction. Covers Web Unlocker API, SERP API, Web Scraper API, and Browser API (Scraping Browser).

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#9095
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能