跳转到内容

获取 Worker 详情

方法: GET

端点: /api/scraper

使用查询参数发送请求。无需身份验证。

Terminal window
curl "https://openapi.coreclaw.com/api/scraper?slug=01KJXYJ7KCHXM0PDZHQD5293XE"
参数示例类型必填说明
slug01KJXYJ7KCHXM0PDZHQD5293XEStringWorker 唯一标识符(即 scraper_slug
{
"code": 0,
"message": "success",
"data": {
"parameters": {
"system": {
"cpus": 0.125,
"memory_bytes": 512,
"max_total_charge": 0,
"max_total_traffic": 0,
"execute_limit_time_seconds": 1800
},
"custom": {
"properties": [
{
"name": "startURLs",
"type": "array",
"title": "起始 URL",
"editor": "json",
"default": [
{ "url": "https://example.com" }
],
"required": true,
"description": "需要采集的起始 URL 列表"
}
]
}
},
"readme": "# Worker 说明\n\n这里是 Worker 的描述信息。",
"version": "v1.0.1"
}
}
参数示例类型说明
code0Integer全局状态码
messagesuccessString响应消息
data-Object响应数据
参数示例类型说明
parameters-ObjectWorker 参数结构
readme-StringWorker 说明文档(Markdown)
versionv1.0.1String最新版本号

注意: 此端点返回 memory_bytes,而运行 Worker 的请求参数使用 memory。两者表示同一个值,单位均为 MB。

参数示例类型说明
cpus0.125number设备 CPU 核心数
memory_bytes512Integer设备内存(MB)
max_total_charge0Integer最大执行费用(美元)
max_total_traffic0Integer最大执行流量(MB)
execute_limit_time_seconds1800Integer执行超时(秒)

custom 对象的结构因 Worker 而异。通过此接口可以了解某个 Worker 需要哪些输入字段。

参数示例类型说明
properties-Array自定义参数定义数组

每个 properties 元素:

参数示例类型说明
namestartURLsString参数名
typearrayString参数类型
title起始 URLString显示标题
editorjsonString编辑器类型
default[{“url”: “https://example.com”}]Array默认值
requiredtrueBoolean是否必填
description需要采集的起始 URL 列表String参数描述
{
"code": 50001,
"message": "脚本不存在",
"data": null
}