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,
"storage": {
"expires_in": "7d"
},
"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,
"storage": { "expires_in": "7d" },
"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,
storage: {expires_in: '7d'},
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,
'storage' => [
'expires_in' => '7d'
],
'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 \"storage\": {\n \"expires_in\": \"7d\"\n },\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 \"storage\": {\n \"expires_in\": \"7d\"\n },\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 \"storage\": {\n \"expires_in\": \"7d\"\n },\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{
"storage": {
"expires_in": "7d"
},
"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,
"storage": {
"expires_in": "7d"
},
"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,
"storage": { "expires_in": "7d" },
"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,
storage: {expires_in: '7d'},
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,
'storage' => [
'expires_in' => '7d'
],
'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 \"storage\": {\n \"expires_in\": \"7d\"\n },\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 \"storage\": {\n \"expires_in\": \"7d\"\n },\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 \"storage\": {\n \"expires_in\": \"7d\"\n },\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{
"storage": {
"expires_in": "7d"
},
"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。storage.expires_in 以保持此爬虫的存储文件超过默认的7天。可选值:7d、10d、30d、60d、90d、180d、365d 或 never。详情请参见 Storage。授权
Bearer认证头格式为Bearer ,其中是你的认证令牌。
请求体
爬取的起始点。
爬取的最大页面数。推荐用于大多数用例,如爬取整个网站。
控制此爬取的存储文件(其爬取的页面)保留多长时间。如果省略,则保留7天。实际生效的值在响应中以storage.expires_in返回。请参阅功能文档中的存储部分。无效值将返回400,代码为invalid_storage_expires_in。
Show child attributes
Show child attributes
使用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
响应
爬取成功启动。
应用于此抓取存储文件的保留。
Show child attributes
Show child attributes
抓取 ID
对象的类型。此端点为 "crawl"。
in_progress 或 completed
创建时间(epoch格式)
创建时间(日期格式)
抓取过程的当前深度。
已抓取页面的数量
此请求消耗的积分数量。在执行完成后填充。积分是计费的真实来源。
此请求的估计成本(以美元计)。在执行完成后填充。根据消耗的积分和你的计划费率计算——99% 准确,但 credits_consumed 是权威值。
此页面对您有帮助吗?