> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# OnPage API 资源

> 此端点将提供资源列表，包括图像、脚本、样式表和损坏的元素。



## OpenAPI

````yaml openapi/zh/dataforseo.json POST /dataforseo/on_page/resources
openapi: 3.0.3
info:
  title: DataForSEO API
  version: 1.0.0
  description: 通过 AIsa 统一网关提供的 DataForSEO API 端点。
servers:
  - url: https://api.aisa.one/apis/v1
security:
  - BearerAuth: []
paths:
  /dataforseo/on_page/resources:
    post:
      summary: OnPage API 资源
      description: 此端点将提供资源列表，包括图像、脚本、样式表和损坏的元素。
      operationId: post_dataforseo_on_page_resources
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  description: >-
                    任务 ID，必填字段；您可以从 Task POST 端点的响应中获取此
                    ID。示例：“07131248-1535-0216-1000-17384017ad04”
                url:
                  type: string
                  description: >-
                    页面 URL，可选字段。如果要获取特定页面的资源，请指定此字段。请注意，要从特定 URL
                    获取资源的元数据，应在此字段中指定该 URL；如果在设置任务时未指定
                    url，结果中的资源元数据将基于爬虫首次发现该资源的页面数据返回。
                limit:
                  type: integer
                  description: 返回资源的最大数量，可选字段，默认值：100，最大值：1000
                offset:
                  type: integer
                  description: >-
                    返回资源在 results 数组中的偏移量，可选字段，默认值：0。如果指定值 10，则 results
                    数组中的前十个资源将被省略，并提供后续资源的数据
                filters:
                  type: array
                  items:
                    type: string
                  description: >-
                    结果过滤参数数组，可选字段；您可以同时添加多个过滤器（最多 8 个过滤器）；应在条件之间设置逻辑运算符
                    and、or；支持以下运算符：regex, not_regex, , , >, >=, =, , in, not_in,
                    like, not_like；您可以将 % 运算符与 like 和 not_like
                    一起使用，以匹配包含零个或多个字符的任意字符串；示例：["resource_type","=","stylesheet"]
                    [["resource_type","=","image"],
                    "and",["checks.is_https","=",false]]
                    [["fetch_timing.duration_time",">",1],"and",[["total_transfer_size",">",100],"or",["checks.high_loading_time","=",true]]]
                    可用过滤器的完整列表可通过此链接查看。
                relevant_pages_filters:
                  type: array
                  items:
                    type: string
                  description: >-
                    按相关页面筛选资源。可选字段。你可以使用此字段获取与所定义参数匹配的页面中的资源。此处可以应用 pages
                    端点支持的相同筛选条件。你可以同时添加多个筛选条件（最多 8 个）。应在条件之间设置逻辑运算符
                    and、or。支持以下运算符：regex、not_regex、 、 、>、>=、=、
                    、in、not_in、like、not_like。你可以将 % 运算符与 like 和 not_like
                    搭配使用，以匹配包含零个或多个字符的任意字符串。示例：["checks.no_image_title","=",true]
                order_by:
                  type: array
                  items:
                    type: string
                  description: >-
                    结果排序规则，可选字段。可以使用与 filters 数组中相同的值对结果进行排序。可用排序类型：asc –
                    结果将按升序排列；desc –
                    结果将按降序排列。应使用逗号设置排序类型，示例：["size,desc"]。请注意，单个请求最多可以设置三条排序规则。应使用逗号分隔多条排序规则，示例：["size,desc","fetch_timing.fetch_end,desc"]
                search_after_token:
                  type: string
                  description: >-
                    用于后续请求的 token；可选字段；每个请求的响应中都会在同名字段中提供；尝试通过单次请求获取超过 20,000
                    条结果时，请使用此参数以避免超时；通过指定响应数组中的唯一 search_after_token
                    值，您将获得初始任务的后续结果；每个后续任务的 search_after_token
                    值都是唯一的；注意：如果请求中指定了 search_after_token，则所有其他参数都应与上一个请求保持一致
                tag:
                  type: string
                  description: >-
                    用户定义的任务标识符。可选字段。字符数限制为 255。您可以使用此参数标识任务并将其与结果匹配；您将在响应的 data
                    对象中找到指定的 tag 值
              required:
                - id
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  version:
                    type: string
                    description: API 的当前版本
                  status_code:
                    type: integer
                    description: 通用状态码；您可以在此处查看完整的响应码列表。注意：我们强烈建议设计必要的系统来处理相关异常或错误情况
                  status_message:
                    type: string
                    description: 常规信息消息；可在此处查看常规信息消息的完整列表
                  time:
                    type: string
                    description: 执行时间（秒）
                  cost:
                    type: number
                    description: 任务总成本（美元）
                  tasks_count:
                    type: integer
                    description: tasks 数组中的任务数量
                  tasks_error:
                    type: integer
                    description: 返回错误的 tasks 数组中的任务数量
                  tasks:
                    type: array
                    items:
                      type: string
                    description: 任务数组
                  tasks.id:
                    type: string
                    description: 任务标识符，系统中采用 UUID 格式的唯一任务标识符
                  tasks.status_code:
                    type: integer
                    description: DataForSEO 生成的任务状态码；范围为：10000-60000；完整响应代码列表可在此处查看
                  tasks.status_message:
                    type: string
                    description: 任务的信息性消息，你可以在此处查看通用信息性消息的完整列表
                  tasks.time:
                    type: string
                    description: 执行时间（秒）
                  tasks.cost:
                    type: number
                    description: 任务成本（美元）
                  tasks.result_count:
                    type: integer
                    description: 结果数组中的元素数量
                  tasks.path:
                    type: array
                    items:
                      type: string
                    description: URL 路径
                  tasks.data:
                    type: object
                    description: 包含您在 POST 请求中指定的相同参数
                  tasks.result:
                    type: array
                    items:
                      type: string
                    description: 结果数组
                  tasks.result.crawl_progress:
                    type: string
                    description: 抓取会话的状态，可能的值：in_progress、finished
                  tasks.result.crawl_status:
                    type: object
                    description: 抓取会话的详细信息
                  tasks.result.crawl_status.max_crawl_pages:
                    type: integer
                    description: 最大抓取页面数，表示设置任务时指定的 max_crawl_pages 限制
                  tasks.result.crawl_status.pages_in_queue:
                    type: integer
                    description: 当前位于抓取队列中的页面数量
                  tasks.result.crawl_status.pages_crawled:
                    type: integer
                    description: 已抓取页面数
                  tasks.result.total_items_count:
                    type: integer
                    description: 已抓取的相关项目总数
                  tasks.result.items_count:
                    type: integer
                    description: results 数组中的项目数量
                  tasks.result.items:
                    type: array
                    items:
                      type: string
                    description: items 数组
                  tasks.result.items.resource_type:
                    type: string
                    description: 返回资源的类型，可能的类型：script、image、stylesheet、broken
                  tasks.result.items.meta:
                    type: object
                    description: >-
                      资源属性；该值取决于 resource_type；请注意，如果设置任务时未指定
                      url，则返回的资源元数据基于爬虫首次发现该资源的页面数据；如需获取特定 url
                      中的资源元数据，请在设置任务时指定该 URL
                  tasks.result.items.meta.alternative_text:
                    type: string
                    description: 图片 alt 属性的内容，其值取决于 resource_type
                  tasks.result.items.meta.title:
                    type: string
                    description: 标题
                  tasks.result.items.meta.original_width:
                    type: integer
                    description: 原始图像宽度（px）
                  tasks.result.items.meta.original_height:
                    type: integer
                    description: 原始图像高度（单位：px）
                  tasks.result.items.meta.width:
                    type: integer
                    description: 图片宽度（px）
                  tasks.result.items.meta.height:
                    type: integer
                    description: 图像高度（px）
                  tasks.result.items.status_code:
                    type: integer
                    description: 给定资源所在页面的状态码
                  tasks.result.items.location:
                    type: string
                    description: location 标头指示页面要重定向到的 URL
                  tasks.result.items.url:
                    type: string
                    description: 资源 URL
                  tasks.result.items.size:
                    type: integer
                    description: 资源大小，表示给定资源的大小，以字节为单位
                  tasks.result.items.encoded_size:
                    type: integer
                    description: 编码后的资源大小表示已编码资源的大小，以字节为单位
                  tasks.result.items.total_transfer_size:
                    type: integer
                    description: 压缩资源大小，表示给定资源压缩后的大小（以字节为单位）
                  tasks.result.items.fetch_time:
                    type: string
                    description: >-
                      资源获取的日期和时间，采用 UTC 格式：“yyyy-mm-dd hh-mm-ss
                      +00:00”；示例：2021-02-17 13:54:15 +00:00
                  tasks.result.items.fetch_timing:
                    type: object
                    description: 资源获取时间范围
                  tasks.result.items.fetch_timing.duration_time:
                    type: integer
                    description: 表示获取资源耗时多少毫秒
                  tasks.result.items.fetch_timing.fetch_start:
                    type: integer
                    description: 开始下载资源的时间，即浏览器开始下载资源所需的时间
                  tasks.result.items.fetch_timing.fetch_end:
                    type: integer
                    description: 完成资源下载所需的时间，即浏览器完成资源下载所需的时长
                  tasks.result.items.cache_control:
                    type: object
                    description: 缓存说明
                  tasks.result.items.cache_control.cachable:
                    type: boolean
                    description: 指示资源是否可缓存
                  tasks.result.items.cache_control.ttl:
                    type: integer
                    description: 生存时间，浏览器缓存资源的时长；以毫秒为单位
                  tasks.result.items.checks:
                    type: object
                    description: 资源检查数组的内容取决于 resource_type
                  tasks.result.items.checks.no_content_encoding:
                    type: boolean
                    description: >-
                      无内容编码的资源，指示页面内容是否未使用压缩算法；适用于具有以下 resource_type
                      的项目：script、image、stylesheet、broken
                  tasks.result.items.checks.high_loading_time:
                    type: boolean
                    description: >-
                      加载时间较长的资源。指示资源加载时间是否超过 3 秒；适用于具有以下 resource_type
                      的项目：script、image、stylesheet、broken
                  tasks.result.items.checks.is_redirect:
                    type: boolean
                    description: >-
                      资源存在重定向，表示包含此资源的页面是否通过 3XX 重定向至其他页面；适用于具有以下 resource_type
                      的项目：script、image、stylesheet、broken
                  tasks.result.items.checks.is_4xx_code:
                    type: boolean
                    description: 带有 4xx 状态码的资源，表示包含此资源的页面是否返回 4XX 响应码
                  tasks.result.items.checks.is_5xx_code:
                    type: boolean
                    description: 状态码为 5xx 的资源，指示包含此资源的页面是否返回 5XX 响应代码
                  tasks.result.items.checks.is_broken:
                    type: boolean
                    description: >-
                      资源损坏。指示包含此资源的页面是否返回 4xx、5xx 响应代码，或资源内部是否存在损坏的元素；适用于具有以下
                      resource_type 的项目：script、image、stylesheet、broken
                  tasks.result.items.checks.is_www:
                    type: boolean
                    description: >-
                      位于 www 的页面，表示包含此资源的页面是否位于 www 子域名；适用于具有以下 resource_type
                      的项目：script、image、stylesheet、broken
                  tasks.result.items.checks.is_https:
                    type: boolean
                    description: >-
                      使用 https 协议的页面，适用于以下 resource_type
                      的项目：script、image、stylesheet、broken
                  tasks.result.items.checks.is_http:
                    type: boolean
                    description: >-
                      可通过 http 协议访问的页面，适用于以下 resource_type
                      的项目：script、image、stylesheet、broken
                  tasks.result.items.checks.original_size_displayed:
                    type: boolean
                    description: 图像以原始尺寸显示，表示图像是否以原始尺寸显示；适用于具有以下 resource_type 的项目：image
                  tasks.result.items.checks.is_minified:
                    type: boolean
                    description: >-
                      资源是否已压缩，指示样式表或脚本的内容是否已压缩；适用于具有以下 resource_type
                      的项目：stylesheet、script
                  tasks.result.items.checks.has_redirect:
                    type: boolean
                    description: >-
                      对于 resource_type 为 script、image 的项目，该资源存在可用重定向；如果
                      resource_type 为 image，此字段表示是否有其他页面和/或资源的重定向指向该图片；如果
                      resource_type 为 script，此字段表示该脚本是否包含重定向
                  tasks.result.items.checks.has_subrequests:
                    type: boolean
                    description: >-
                      资源包含子请求，表示 stylesheet 或 script 的内容是否包含其他请求；适用于具有以下
                      resource_type 的项目：stylesheet、script
                  tasks.result.items.checks.from_sitemap:
                    type: boolean
                    description: 资源是否在网站的站点地图中找到；若为 true，则表示该资源在网站的站点地图中找到
                  tasks.result.resource_errors:
                    type: object
                    description: 资源错误和警告
                  tasks.result.resource_errors.errors:
                    type: array
                    items:
                      type: string
                    description: 资源错误
                  tasks.result.resource_errors.errors.line:
                    type: integer
                    description: 发现错误的行
                  tasks.result.resource_errors.errors.column:
                    type: integer
                    description: 发现错误的列
                  tasks.result.resource_errors.errors.message:
                    type: string
                    description: 错误的文本消息；可在此处查看所有可能的 HTML 错误列表
                  tasks.result.resource_errors.errors.status_code:
                    type: integer
                    description: >-
                      错误状态码；可能的值：0 — 未识别错误；501 — Html 解析错误；1501 — JS 解析错误；2501 —
                      CSS 解析错误；3501 — 图片解析错误；3502 — 图片缩放比例为零；3503 — 图片尺寸为零；3504
                      — 图片格式无效
                  tasks.result.resource_errors.warnings:
                    type: array
                    items:
                      type: string
                    description: 资源警告
                  tasks.result.resource_errors.warnings.line:
                    type: integer
                    description: '警告所涉及的行；请注意，如果 "line": 0，则警告涉及整个页面'
                  tasks.result.resource_errors.warnings.column:
                    type: integer
                    description: '警告所涉及的列；请注意，如果 "column": 0，则警告涉及整个页面'
                  tasks.result.resource_errors.warnings.message:
                    type: string
                    description: >-
                      警告的文本消息，可能的消息："Has node with more than 60 childs." – HTML
                      页面中至少有 1 个标签嵌套超过 60 个同级标签；"Has more that 1500 nodes." –
                      DOM 树包含超过 1,500 个元素；"HTML depth more than 32 tags." – DOM
                      深度超过 32 个节点
                  tasks.result.resource_errors.warnings.status_code:
                    type: integer
                    description: >-
                      警告状态码。可选值：0 — 未识别的警告；1 — 存在拥有超过 60 个子节点的节点；2 — 节点数超过 1500
                      个；3 — HTML 深度超过 32 个标签
                  tasks.result.resource_errors.content_encoding:
                    type: string
                    description: 编码类型
                  tasks.result.resource_errors.media_type:
                    type: string
                    description: 用于显示资源的媒体类型
                  tasks.result.resource_errors.accept_type:
                    type: string
                    description: >-
                      表示预期的资源类型；例如，如果 "resource_type": "broken"，accept_type
                      将表示损坏资源的类型；可能的值：any、none、image、sitemap、robots、script、stylesheet、redirect、html、text、other、font
                  tasks.result.resource_errors.server:
                    type: string
                    description: 服务器版本
                  tasks.result.resource_errors.last_modified:
                    type: object
                    description: 包含与资源相关的变更数据；如果没有数据，则该值为 null
                  tasks.result.resource_errors.last_modified.header:
                    type: string
                    description: >-
                      标头上次修改的日期和时间，采用 UTC 格式：“yyyy-mm-dd hh-mm-ss +00:00”
                      示例：2019-11-15 12:57:46 +00:00；如果没有数据，则值为 null
                  tasks.result.resource_errors.last_modified.sitemap:
                    type: string
                    description: >-
                      站点地图最后修改的日期和时间，采用 UTC 格式：“yyyy-mm-dd hh-mm-ss
                      +00:00”。示例：2019-11-15 12:57:46 +00:00。如果没有数据，则值为 null。
                  tasks.result.resource_errors.last_modified.meta_tag:
                    type: string
                    description: >-
                      元标记最后修改的日期和时间，采用 UTC 格式：“yyyy-mm-dd hh-mm-ss
                      +00:00”。示例：2019-11-15 12:57:46 +00:00。如果没有数据，则值为 null。
        '400':
          description: 错误请求
        '401':
          description: 未授权
        '429':
          description: 超出速率限制
        '500':
          description: 内部服务器错误
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````