Skip to main content
POST
/
datasets
/
v3
/
trigger
cURL
curl --request POST \
  --url https://api.brightdata.com/datasets/v3/trigger \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "url": "https://il.linkedin.com/company/bright-data"
  }
]
'
{
  "snapshot_id": "s_m4x7enmven8djfqak"
}

正文

要供抓取器使用的输入。可以作为 JSON 或 CSV 文件提供:
Content-Type
string
Content-Type: application/json输入的 JSON 数组
示例: [{"url":"https://www.airbnb.com/rooms/50122531"}]

Content-Type: multipart/form-data一个 CSV 文件,字段名为 data
示例 (curl): data=@path/to/your/file.csv

Web Scraper 类型

每种抓取器可能需要不同的输入。主要有两种类型的抓取器:

1. PDP

这些抓取器需要 URL 作为输入。PDP 抓取器从网页中提取详细的产品信息,如规格、定价和功能。

2. Discovery

Discovery 抓取器允许您通过搜索、类别、关键词等来探索和发现新实体/产品。
ae.com.png

请求示例

PDP 以 URL 输入

PDP 的输入格式始终是 URL,指向要抓取的页面。
Sample Request
curl -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" -d '[{"url":"https://www.airbnb.com/rooms/50122531"},{"url":"https://www.airbnb.com/rooms/50127677"}]' "https://api.brightdata.com/datasets/v3/trigger?dataset_id=gd_ld7ll037kqy322v05&format=json&uncompressed_webhook=true"

基于 discovery 方法的 Discovery 输入

Sample Request
curl -H "Authorization: Bearer x2x3fdaaddrer" -H "Content-Type: application/json" -d '[{"keyword":"light bulb"},{"keyword":"dog toys"},{"keyword":"home decor"}]' "https://api.brightdata.com/datasets/v3/trigger?dataset_id=gd_l7q7dkf244hwjntr0&endpoint=https://webhook-url.com&auth_header=QWxhZGRpbjpPcGVuU2VzYW1l&notify=https://notify-me.com/&format=ndjson&uncompressed_webhook=true&type=discover_new&discover_by=keyword&limit_per_input=10"
discovery 的输入格式可以根据特定的抓取器有所不同。输入可以是:
[{"keyword": "light bulb"},{"keyword": "dog toys"},{"keyword": "home decor"}]
以及更多。了解每个抓取器需要的输入,请参见 这里.

Authorizations

Authorization
string
header
required

在 Authorization 头中使用您的 Bright Data API Key 作为 Bearer token。

认证方法:

  1. 从 Bright Data 账户设置获取您的 API Key: https://brightdata.com/cp/setting/users
  2. 在请求的 Authorization 头中包含 API Key
  3. 格式: Authorization: Bearer YOUR_API_KEY

示例:

Authorization: Bearer b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df

了解如何获取 Bright Data API Key: https://docs.brightdata.com/cn/api-reference/authentication#如何生成新的-api-key?

Query Parameters

dataset_id
string
required

触发数据采集的数据集 ID。

Example:

"gd_l1vikfnt1wgvvqz95w"

custom_output_fields
string

输出列列表,用 | 分隔 (例如 url|about.updated_on)。过滤响应,仅包含指定字段。

Example:

"url|about.updated_on"

type
enum<string>

设置为 "discover_new" 以触发包含发现阶段的数据采集。

Available options:
discover_new
discover_by
string

指定使用哪种发现方法。可选项包括: "keyword"、"best_sellers_url"、"category_url"、"location" 等(根据具体 API)。仅对包含发现阶段的采集相关。

include_errors
boolean

在结果中包含错误报告。

limit_per_input
number

每个输入的结果数量限制。仅对包含发现阶段的采集相关。

Required range: x >= 1
limit_multiple_results
number

限制总结果数量。

Required range: x >= 1
notify
string

当采集完成时,通知将发送到此 URL,包含 snapshot_id 和状态。

endpoint
string

数据将被传送到的 webhook URL。

format
enum<string>

指定传送到 webhook 的数据格式。

Available options:
json,
ndjson,
jsonl,
csv
auth_header
string

发送通知到 notify URL 或通过 webhook 传输数据时使用的授权头。

uncompressed_webhook
boolean

默认情况下,数据会被压缩发送到 webhook。传 true 可不压缩发送。

Body

{key}
any

Response

200 - application/json

采集任务成功启动

snapshot_id
string

可在后续 API 中使用的请求 ID

Example:

"s_m4x7enmven8djfqak"