异步触发爬虫进行批量采集
使用 POST /dca/trigger 为 Scraper Studio 采集器启动异步批量采集。请求体是输入对象的 JSON 数组,并返回 collection_id 以便稍后获取结果。
POST /dca/trigger 为已发布的 Bright Data Scraper Studio 采集器启动异步批量采集。请求体是输入对象的 JSON 数组,每个对象都必须与采集器的输入模式匹配。
该端点会立即返回一个 collection_id。采集完成后,使用该 ID 调用接收批量数据端点(GET /dca/dataset)来获取结果。
请求
请求体是输入对象的 JSON 数组。每个对象都必须与你在 Scraper Studio 中为采集器定义的输入模式匹配。基于 URL 的采集器可能需要url 字段,而其他采集器可能需要 keyword、location、country 等字段或自定义输入字段。
请求体必须是 JSON 数组。如果只有单个输入,请发送只包含一个对象的数组。
响应
collection_id 标识本次采集运行。调用 GET /dca/dataset 时,将它作为 id 的值来获取结果。
何时使用批量采集
在以下情况下使用批量采集(POST /dca/trigger):
- 你需要在一次运行中处理多个输入。
- 你可以等待采集完成后再获取结果。
- 你希望稍后通过
collection_id获取结果。 - 你正在构建数据集或定时采集工作流。
错误
重试行为
使用相同的输入重新触发会创建一个带有新collection_id 的新采集运行。该端点不是幂等的,也不会在多次运行之间对输入去重。如果只想重试失败的输入,请使用获取作业错误识别本次运行中失败的输入,然后仅用这些输入触发一次新的采集。授权
Use your Bright Data API Key as a Bearer token in the Authorization header.
How to authenticate:
- Obtain your API Key from the Bright Data account settings at https://brightdata.com/cp/setting/users
- Include the API Key in the Authorization header of your requests
- Format:
Authorization: Bearer YOUR_API_KEY
Example:
Learn how to get your Bright Data API key: https://docs.brightdata.com/api-reference/authentication
查询参数
Collector ID of the Scraper Studio scraper to run. The ID starts with c_.
"c_abc123"
Set to dev to trigger the development version of the scraper
Human-readable name for the batch collection.
If another collection is already running, queue this collection to run after it.
Queue name used to group related collection runs. Runs that share a queue start one after another.
Cancels a running collection for this collector and runs this one instead.
Disables media file downloads for this collection.
Sets the maximum time the collection can run. When the deadline is reached, Bright Data terminates the collection. Use h for hours, m for minutes or s for seconds, for example 1h, 30m or 45s.
"1h"
请求体
A JSON array of input objects. Each object must match the input schema defined for the collector. A URL-based collector may require a url field, while other collectors may require fields such as keyword, location or country. For a single input, send an array with one object.
Example field for collectors that take a target URL. Replace with the fields your collector expects.