跳转到主要内容
POST
/
v1
/
scrapes
启动网页抓取
curl --request POST \
  --url https://api.olostep.com/v1/scrapes \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url_to_scrape": "<string>",
  "wait_before_scraping": 123,
  "formats": [
    "html"
  ],
  "remove_css_selectors": "default",
  "actions": [
    {
      "type": "wait",
      "milliseconds": 1
    }
  ],
  "country": "<string>",
  "transformer": "postlight",
  "remove_images": false,
  "remove_class_names": [
    "<string>"
  ],
  "llm_extract": {
    "schema": {}
  },
  "links_on_page": {
    "absolute_links": true,
    "query_to_order_links_by": "<string>",
    "include_links": [
      "<string>"
    ],
    "exclude_links": [
      "<string>"
    ]
  },
  "screen_size": {
    "screen_type": "default",
    "screen_width": 123,
    "screen_height": 123
  },
  "screenshot": {
    "full_page": true
  },
  "metadata": {}
}
'
{
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "metadata": {},
  "url_to_scrape": "<string>",
  "result": {
    "html_content": "<string>",
    "markdown_content": "<string>",
    "text_content": "<string>",
    "json_content": "<string>",
    "screenshot_hosted_url": "<string>",
    "html_hosted_url": "<string>",
    "markdown_hosted_url": "<string>",
    "text_hosted_url": "<string>",
    "links_on_page": [
      "<string>"
    ],
    "page_metadata": {
      "status_code": 123,
      "title": "<string>"
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.olostep.com/llms.txt

Use this file to discover all available pages before exploring further.

授权

Authorization
string
header
必填

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

请求体

application/json
url_to_scrape
string<uri>
必填

开始抓取的URL。

wait_before_scraping
integer

在开始抓取前等待的时间,以毫秒为单位。

formats
enum<string>[]

你想要内容的格式。

可用选项:
html,
markdown,
text,
json,
raw_pdf,
screenshot
remove_css_selectors
enum<string>

选项:从内容中移除某些CSS选择器。你也可以传递一个JSON字符串化的特定选择器数组来移除。当此选项设置为默认时,移除的CSS选择器为 ['nav','footer','script','style','noscript','svg',[role=alert],[role=banner],[role=dialog],[role=alertdialog],[role=region][aria-label*=skip i],[aria-modal=true]]

可用选项:
default,
none,
array
actions
(等待 · object | 点击 · object | 填写输入 · object | 滚动 · object)[]

在获取内容之前对页面执行的操作。

country
string

加载请求的住宅国家。 支持的值有: - US (United States) - CA (Canada) - IT (Italy) - IN (India) - GB (England) - JP (Japan) - MX (Mexico) - AU (Australia) - ID (Indonesia) - UA (UAE) - RU (Russia) - RANDOM 一些操作,如抓取Google搜索和Google新闻,支持所有国家。

transformer
enum<string>

指定要使用的HTML转换器(如果有)。使用Postlight的Mercury Parser库来移除广告和其他不需要的内容。

可用选项:
postlight,
none
remove_images
boolean
默认值:false

选项:从抓取的内容中移除图像。默认为false。

remove_class_names
string[]

要从内容中移除的类名列表。

parser
object

当定义json作为格式时,你可以使用此参数指定要使用的解析器。解析器对于从网页中提取结构化内容非常有用。Olostep为大多数常见网页内置了一些解析器,你也可以创建自己的解析器。

llm_extract
object

使用此选项,你可以获取你抓取的页面上存在的所有链接。

screen_size
object

屏幕尺寸配置。可以通过 screen_type 获取预设尺寸:desktop (1920x1080)、mobile (414x896) 或 default (768x1024)。

screenshot
object
metadata
object

用户定义的元数据。目前尚不支持。

响应

成功响应包含抓取启动的详细信息。

id
string

抓取 ID

object
string

对象类型。此端点为 "scrape"。

created
number

创建的纪元时间

metadata
object

用户定义的元数据。

url_to_scrape
string

被抓取的 URL。

result
object