curl --request POST \
--url https://api.olostep.com/v1/crawls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_url": "<string>",
"max_pages": 123,
"include_urls": [
"<string>"
],
"exclude_urls": [
"<string>"
],
"max_depth": 123,
"include_external": true,
"include_subdomain": true,
"search_query": "<string>",
"top_n": 123,
"webhook": "<string>",
"timeout": 123,
"follow_robots_txt": true,
"scrape_options": {
"formats": [
"markdown",
"screenshot"
],
"parser": "@olostep/extract-emails"
}
}
'import requests
url = "https://api.olostep.com/v1/crawls"
payload = {
"start_url": "<string>",
"max_pages": 123,
"include_urls": ["<string>"],
"exclude_urls": ["<string>"],
"max_depth": 123,
"include_external": True,
"include_subdomain": True,
"search_query": "<string>",
"top_n": 123,
"webhook": "<string>",
"timeout": 123,
"follow_robots_txt": True,
"scrape_options": {
"formats": ["markdown", "screenshot"],
"parser": "@olostep/extract-emails"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start_url: '<string>',
max_pages: 123,
include_urls: ['<string>'],
exclude_urls: ['<string>'],
max_depth: 123,
include_external: true,
include_subdomain: true,
search_query: '<string>',
top_n: 123,
webhook: '<string>',
timeout: 123,
follow_robots_txt: true,
scrape_options: {formats: ['markdown', 'screenshot'], parser: '@olostep/extract-emails'}
})
};
fetch('https://api.olostep.com/v1/crawls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.olostep.com/v1/crawls",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'start_url' => '<string>',
'max_pages' => 123,
'include_urls' => [
'<string>'
],
'exclude_urls' => [
'<string>'
],
'max_depth' => 123,
'include_external' => true,
'include_subdomain' => true,
'search_query' => '<string>',
'top_n' => 123,
'webhook' => '<string>',
'timeout' => 123,
'follow_robots_txt' => true,
'scrape_options' => [
'formats' => [
'markdown',
'screenshot'
],
'parser' => '@olostep/extract-emails'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.olostep.com/v1/crawls"
payload := strings.NewReader("{\n \"start_url\": \"<string>\",\n \"max_pages\": 123,\n \"include_urls\": [\n \"<string>\"\n ],\n \"exclude_urls\": [\n \"<string>\"\n ],\n \"max_depth\": 123,\n \"include_external\": true,\n \"include_subdomain\": true,\n \"search_query\": \"<string>\",\n \"top_n\": 123,\n \"webhook\": \"<string>\",\n \"timeout\": 123,\n \"follow_robots_txt\": true,\n \"scrape_options\": {\n \"formats\": [\n \"markdown\",\n \"screenshot\"\n ],\n \"parser\": \"@olostep/extract-emails\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.olostep.com/v1/crawls")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_url\": \"<string>\",\n \"max_pages\": 123,\n \"include_urls\": [\n \"<string>\"\n ],\n \"exclude_urls\": [\n \"<string>\"\n ],\n \"max_depth\": 123,\n \"include_external\": true,\n \"include_subdomain\": true,\n \"search_query\": \"<string>\",\n \"top_n\": 123,\n \"webhook\": \"<string>\",\n \"timeout\": 123,\n \"follow_robots_txt\": true,\n \"scrape_options\": {\n \"formats\": [\n \"markdown\",\n \"screenshot\"\n ],\n \"parser\": \"@olostep/extract-emails\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olostep.com/v1/crawls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_url\": \"<string>\",\n \"max_pages\": 123,\n \"include_urls\": [\n \"<string>\"\n ],\n \"exclude_urls\": [\n \"<string>\"\n ],\n \"max_depth\": 123,\n \"include_external\": true,\n \"include_subdomain\": true,\n \"search_query\": \"<string>\",\n \"top_n\": 123,\n \"webhook\": \"<string>\",\n \"timeout\": 123,\n \"follow_robots_txt\": true,\n \"scrape_options\": {\n \"formats\": [\n \"markdown\",\n \"screenshot\"\n ],\n \"parser\": \"@olostep/extract-emails\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"status": "<string>",
"created": 123,
"start_date": "<string>",
"start_url": "<string>",
"max_pages": 123,
"max_depth": 123,
"exclude_urls": [
"<string>"
],
"include_urls": [
"<string>"
],
"include_external": true,
"search_query": "<string>",
"top_n": 123,
"current_depth": 123,
"pages_count": 123,
"webhook": "<string>",
"follow_robots_txt": true,
"credits_consumed": 123,
"cost_usd": 123
}创建爬虫
启动一个新的爬虫。你会收到一个 id 用于跟踪进度。操作可能需要1-10分钟,具体取决于站点、深度和页面参数。
curl --request POST \
--url https://api.olostep.com/v1/crawls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_url": "<string>",
"max_pages": 123,
"include_urls": [
"<string>"
],
"exclude_urls": [
"<string>"
],
"max_depth": 123,
"include_external": true,
"include_subdomain": true,
"search_query": "<string>",
"top_n": 123,
"webhook": "<string>",
"timeout": 123,
"follow_robots_txt": true,
"scrape_options": {
"formats": [
"markdown",
"screenshot"
],
"parser": "@olostep/extract-emails"
}
}
'import requests
url = "https://api.olostep.com/v1/crawls"
payload = {
"start_url": "<string>",
"max_pages": 123,
"include_urls": ["<string>"],
"exclude_urls": ["<string>"],
"max_depth": 123,
"include_external": True,
"include_subdomain": True,
"search_query": "<string>",
"top_n": 123,
"webhook": "<string>",
"timeout": 123,
"follow_robots_txt": True,
"scrape_options": {
"formats": ["markdown", "screenshot"],
"parser": "@olostep/extract-emails"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start_url: '<string>',
max_pages: 123,
include_urls: ['<string>'],
exclude_urls: ['<string>'],
max_depth: 123,
include_external: true,
include_subdomain: true,
search_query: '<string>',
top_n: 123,
webhook: '<string>',
timeout: 123,
follow_robots_txt: true,
scrape_options: {formats: ['markdown', 'screenshot'], parser: '@olostep/extract-emails'}
})
};
fetch('https://api.olostep.com/v1/crawls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.olostep.com/v1/crawls",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'start_url' => '<string>',
'max_pages' => 123,
'include_urls' => [
'<string>'
],
'exclude_urls' => [
'<string>'
],
'max_depth' => 123,
'include_external' => true,
'include_subdomain' => true,
'search_query' => '<string>',
'top_n' => 123,
'webhook' => '<string>',
'timeout' => 123,
'follow_robots_txt' => true,
'scrape_options' => [
'formats' => [
'markdown',
'screenshot'
],
'parser' => '@olostep/extract-emails'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.olostep.com/v1/crawls"
payload := strings.NewReader("{\n \"start_url\": \"<string>\",\n \"max_pages\": 123,\n \"include_urls\": [\n \"<string>\"\n ],\n \"exclude_urls\": [\n \"<string>\"\n ],\n \"max_depth\": 123,\n \"include_external\": true,\n \"include_subdomain\": true,\n \"search_query\": \"<string>\",\n \"top_n\": 123,\n \"webhook\": \"<string>\",\n \"timeout\": 123,\n \"follow_robots_txt\": true,\n \"scrape_options\": {\n \"formats\": [\n \"markdown\",\n \"screenshot\"\n ],\n \"parser\": \"@olostep/extract-emails\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.olostep.com/v1/crawls")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_url\": \"<string>\",\n \"max_pages\": 123,\n \"include_urls\": [\n \"<string>\"\n ],\n \"exclude_urls\": [\n \"<string>\"\n ],\n \"max_depth\": 123,\n \"include_external\": true,\n \"include_subdomain\": true,\n \"search_query\": \"<string>\",\n \"top_n\": 123,\n \"webhook\": \"<string>\",\n \"timeout\": 123,\n \"follow_robots_txt\": true,\n \"scrape_options\": {\n \"formats\": [\n \"markdown\",\n \"screenshot\"\n ],\n \"parser\": \"@olostep/extract-emails\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olostep.com/v1/crawls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_url\": \"<string>\",\n \"max_pages\": 123,\n \"include_urls\": [\n \"<string>\"\n ],\n \"exclude_urls\": [\n \"<string>\"\n ],\n \"max_depth\": 123,\n \"include_external\": true,\n \"include_subdomain\": true,\n \"search_query\": \"<string>\",\n \"top_n\": 123,\n \"webhook\": \"<string>\",\n \"timeout\": 123,\n \"follow_robots_txt\": true,\n \"scrape_options\": {\n \"formats\": [\n \"markdown\",\n \"screenshot\"\n ],\n \"parser\": \"@olostep/extract-emails\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"status": "<string>",
"created": 123,
"start_date": "<string>",
"start_url": "<string>",
"max_pages": 123,
"max_depth": 123,
"exclude_urls": [
"<string>"
],
"include_urls": [
"<string>"
],
"include_external": true,
"search_query": "<string>",
"top_n": 123,
"current_depth": 123,
"pages_count": 123,
"webhook": "<string>",
"follow_robots_txt": true,
"credits_consumed": 123,
"cost_usd": 123
}webhook 参数和你的端点 URL,以便在爬虫完成时接收一个 HTTP POST。详情请参阅 Webhooks。授权
Bearer认证头格式为Bearer ,其中是你的认证令牌。
请求体
爬虫的起始点。
爬取的最大页面数量。推荐用于大多数用例,如爬取整个网站。
使用 glob 语法在爬虫中包含的 URL 路径模式。 默认为 /**,包括所有 URL。使用类似 /blog/** 的模式来爬取特定部分(例如,仅博客页面),/products/*.html 用于产品页面,或多个模式用于不同部分。支持标准的 glob 特性,如 *(任意字符)和 **(递归匹配)。
在 glob 模式中排除的 URL 路径名称。例如:/careers/**。排除的 URL 将优先于包含的 URL。
爬虫的最大深度。用于仅提取最多 n 级链接。
爬取一级外部链接。
包含网站的子域名。默认 false。
可选的搜索查询,用于查找特定链接并按相关性排序结果。
可选的数字,仅爬取每个页面上根据搜索查询最相关的前 N 个链接。
在 n 秒后结束爬虫,并完成到那时为止的页面。可能会比提供的超时多花费约 10 秒。
是否遵守 robots.txt 规则。如果设置为 false,爬虫将不顾 robots.txt 的禁止指令抓取网站。默认 true。
控制每个单独页面从 Olostep API 请求的内容。所有字段都是可选的。
Show child attributes
Show child attributes
响应
爬虫启动成功。
爬虫 ID
对象的类型。此端点为 "crawl"。
in_progress 或 completed
创建时间(epoch格式)
创建时间(日期格式)
爬取过程的当前深度。
已爬取页面的数量
此请求消耗的积分数量。在执行完成后填充。积分是计费的真实来源。
此请求的估计成本(以美元计)。在执行完成后填充。根据消耗的积分和你的计划费率计算——99% 准确,但 credits_consumed 是权威值。
此页面对您有帮助吗?