Skip to main content
POST
开始新的爬虫
完成时获取通知: 传递 webhook 参数和你的端点 URL,以便在爬虫完成时接收一个 HTTP POST。详情请参阅 Webhooks

授权

Authorization
string
header
必填

Bearer认证头格式为Bearer ,其中是你的认证令牌。

请求体

application/json
start_url
string
必填

爬虫的起始点。

max_pages
number
必填

爬取的最大页面数量。推荐用于大多数用例,如爬取整个网站。

include_urls
string[]

使用 glob 语法在爬虫中包含的 URL 路径模式。 默认为 /**,包括所有 URL。使用类似 /blog/** 的模式来爬取特定部分(例如,仅博客页面),/products/*.html 用于产品页面,或多个模式用于不同部分。支持标准的 glob 特性,如 *(任意字符)和 **(递归匹配)。

exclude_urls
string[]

在 glob 模式中排除的 URL 路径名称。例如:/careers/**。排除的 URL 将优先于包含的 URL。

max_depth
number

爬虫的最大深度。用于仅提取最多 n 级链接。

include_external
boolean

爬取一级外部链接。

include_subdomain
boolean

包含网站的子域名。默认 false

search_query
string

可选的搜索查询,用于查找特定链接并按相关性排序结果。

top_n
number

可选的数字,仅爬取每个页面上根据搜索查询最相关的前 N 个链接。

webhook
string<uri>

爬虫完成时接收 POST 请求的 HTTPS URL。必须是使用 http://https:// 协议的公开可访问 URL。不能指向 localhost 或私有 IP 地址。查看 Webhooks 了解负载格式和重试行为。

timeout
number

在 n 秒后结束爬虫,并完成到那时为止的页面。可能会比提供的超时多花费约 10 秒。

follow_robots_txt
boolean
默认值:true

是否遵守 robots.txt 规则。如果设置为 false,爬虫将不顾 robots.txt 的禁止指令抓取网站。默认 true

scrape_options
object

控制每个单独页面从 Olostep API 请求的内容。所有字段都是可选的。

响应

爬虫启动成功。

id
string

爬虫 ID

object
string

对象的类型。此端点为 "crawl"。

status
string

in_progresscompleted

created
number

创建时间(epoch格式)

start_date
string

创建时间(日期格式)

start_url
string
max_pages
number
max_depth
number
exclude_urls
string[]
include_urls
string[]
include_external
boolean
search_query
string
top_n
number
current_depth
number

爬取过程的当前深度。

pages_count
number

已爬取页面的数量

webhook
string
follow_robots_txt
boolean
credits_consumed
integer | null

此请求消耗的积分数量。在执行完成后填充。积分是计费的真实来源。

cost_usd
number | null

此请求的估计成本(以美元计)。在执行完成后填充。根据消耗的积分和你的计划费率计算——99% 准确,但 credits_consumed 是权威值。