介绍
# Bright Data - Web Scraping & Search
直接访问 Bright Data 的 Web Unlocker 和 SERP API。
## 设置
**1. 获取 API 密钥:** 从 [Bright Data Dashboard](https://brightdata.com/cp) 获取密钥。
**2. 创建 Web Unlocker Zone:** 在 brightdata.com/cp 点击“添加”(右上角),选择“Unlocker zone”来创建一个 zone。
**3. 设置环境变量:** ```bash export BRIGHTDATA_API_KEY="your-api-key" export BRIGHTDATA_UNLOCKER_ZONE="your-zone-name" ```
## 使用方法
### Google 搜索
搜索 Google 并获取结构化的 JSON 结果(标题、链接、描述)。 ```bash bash scripts/search.sh "query" [cursor] ``` - `cursor`:用于分页的可选页码(从 0 开始索引,默认:0)
### Web Scraping
将任何网页抓取为 markdown 格式。绕过机器人检测和验证码。 ```bash bash scripts/scrape.sh "url" ```
## 输出格式
### 搜索结果
返回包含结构化 `organic` 数组的 JSON: ```json { "organic": [ {"link": "...", "title": "...", "description": "..."} ] } ```
### 抓取结果
返回来自网页的干净 markdown 内容。