跳转到主要内容
POST
开始新的爬取
完成时获取通知: 传递 webhook 参数和你的端点 URL,以在爬虫完成时接收一个 HTTP POST。详情请参见 Webhooks。
结果保留: 传递 storage.expires_in 以保持此爬虫的存储文件超过默认的7天。可选值:7d、10d、30d、60d、90d、180d、365d 或 never。详情请参见 Storage。

授权

Authorization
string
header
必填

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

请求体

application/json
start_url
string
必填

爬取的起始点。

max_pages
number
必填

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

storage
object

控制此爬取的存储文件(其爬取的页面)保留多长时间。如果省略,则保留7天。实际生效的值在响应中以storage.expires_in返回。请参阅功能文档中的存储部分。无效值将返回400,代码为invalid_storage_expires_in。

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获取的内容。所有字段都是可选的。

响应

爬取成功启动。

storage
object

应用于此抓取存储文件的保留。

id
string

抓取 ID

object
string

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

status
string

in_progress 或 completed

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 是权威值。