> ## 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 任务

> OnPage API 根据 60 多个可自定义的页面参数检查网站，识别并显示发现的所有问题和优化机会，以便您可以轻松...



## OpenAPI

````yaml openapi/zh/dataforseo.json POST /dataforseo/on_page/task_post
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/task_post:
    post:
      summary: 设置 OnPage 任务
      description: >-
        OnPage API 根据 60 多项可自定义的页面参数检查网站，识别并显示发现的所有缺陷和优化机会，便于您修复。它会检查每个页面的 meta
        标签、重复内容、图片标签、响应代码及其他参数。您可以在
        [Pages](https://docs.dataforseo.com/v3/on_page/pages.md) 部分查看 OnPage API
        的完整检查参数列表。
      operationId: post_dataforseo_on_page_task_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                target:
                  type: string
                  description: >-
                    目标域名，必填字段。应指定不含 https:// 和 www. 的域名。如果指定页面 URL，则将返回该 URL
                    所属域名的结果。
                max_crawl_pages:
                  type: integer
                  description: >-
                    已抓取页面数上限。必填字段。要在指定域名上抓取的页面数量。注意：如果将 max_crawl_pages 设置为
                    1，并且未指定 start_url
                    或将其设置为主页，则会禁用以下全站检查：test_canonicalization、enable_www_redirect_check、test_hidden_server_signature、test_page_not_found、test_directory_browsing、test_https_redirect。若仍需启用这些检查，请将
                    force_sitewide_checks 设置为 true。如果将 max_crawl_pages 设置为 1，并将
                    start_url 指定为主页以外的页面，则会禁用所有全站检查；若仍需启用这些检查，请将
                    force_sitewide_checks 设置为 true。
                start_url:
                  type: string
                  description: >-
                    要抓取的第一个 URL，可选字段。注意：你应指定绝对 URL；如果要抓取单个页面，请在此字段中指定其 URL，并将
                    max_crawl_pages 参数设置为 1。你也可以使用实时 Instant Pages 端点获取特定页面的数据
                force_sitewide_checks:
                  type: boolean
                  description: 抓取单个页面时启用全站检查；可选字段；设置为 true 可在抓取单个页面时获取全站检查数据；默认值：false。
                priority_urls:
                  type: array
                  items:
                    type: string
                  description: >-
                    绕过队列进行抓取的 URL，可选字段；此数组中指定的 URL 将优先抓取并绕过抓取队列；注意：应指定绝对
                    URL；最多可以指定 20 个 URL；数组中的所有 URL 都必须属于目标域名；除非将
                    allow_subdomains 参数设置为 true，否则将忽略子域名；示例："priority_urls": [
                    "https://dataforseo.com/apis/serp-api",
                    "https://dataforseo.com/contact" ]
                max_crawl_depth:
                  type: integer
                  description: >-
                    抓取深度，可选字段，即待抓取页面的链接层级深度；例如，抓取起始页面为第 0 层，该页面所链接的页面为第 1
                    层，依此类推。
                crawl_delay:
                  type: integer
                  description: 请求之间的延迟（毫秒），可选字段；爬虫向服务器发起请求时的自定义间隔，默认值：2000
                store_raw_html:
                  type: boolean
                  description: >-
                    存储已抓取页面的 HTML 可选字段；如果要使用 OnPage Raw HTML 端点获取页面的 HTML，请设置为
                    true；默认值：false
                enable_content_parsing:
                  type: boolean
                  description: >-
                    解析已抓取页面上的内容；可选字段；设置为 true 以使用 OnPage Content Parsing
                    端点；默认值：false
                support_cookies:
                  type: boolean
                  description: 是否在抓取的页面上支持 Cookie；可选字段，设置为 true 可在抓取页面时支持 Cookie；默认值：false
                accept_language:
                  type: string
                  description: >-
                    用于访问网站的语言标头，可选字段。支持所有区域设置格式（xx、xx-XX、xxx-XX
                    等）。注意：如果未指定此参数，某些网站可能会拒绝访问；在这种情况下，响应数组中返回的页面将包含
                    "type":"broken
                custom_robots_txt:
                  type: string
                  description: '自定义 robots.txt 设置，可选字段，示例：Disallow: /directory1/'
                robots_txt_merge_mode:
                  type: string
                  description: >-
                    合并或覆盖 robots.txt 设置 可选字段 可选值：merge、override；如果要忽略网站抓取限制及其他
                    robots.txt 设置，请设为 override 默认值：merge；注意：如果设为 override，请指定
                    custom_robots_txt 参数
                custom_user_agent:
                  type: string
                  description: >-
                    自定义用户代理。可选字段，用于抓取网站的自定义用户代理。示例：Mozilla/5.0 (Macintosh; Intel
                    Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko)
                    Chrome/83.0.4103.116 Safari/537.36。默认值：Mozilla/5.0
                    (compatible; RSiteAuditor)
                browser_preset:
                  type: string
                  description: >-
                    浏览器屏幕参数预设，可选字段；如果使用此字段，则无需指定
                    browser_screen_width、browser_screen_height、browser_screen_scale_factor；可用值：desktop、mobile、tablet；desktop
                    预设将应用以下值：browser_screen_width: 1920 browser_screen_height:
                    1080 browser_screen_scale_factor: 1；mobile
                    预设将应用以下值：browser_screen_width: 390 browser_screen_height:
                    844 browser_screen_scale_factor: 3；tablet
                    预设将应用以下值：browser_screen_width: 1024 browser_screen_height:
                    1366 browser_screen_scale_factor: 2 注意：要使用此参数，请将
                    enable_javascript 或 enable_browser_rendering 设置为 true
                browser_screen_width:
                  type: integer
                  description: >-
                    浏览器屏幕宽度，可选字段；你可以设置自定义浏览器屏幕宽度，以针对特定设备执行审计；如果使用此字段，则无需指定
                    browser_preset，因为它将被忽略；注意：要使用此参数，请将 enable_javascript 或
                    enable_browser_rendering 设置为 true；最小值（像素）：240；最大值（像素）：9999
                browser_screen_height:
                  type: integer
                  description: >-
                    浏览器屏幕高度，可选字段；你可以设置自定义浏览器屏幕高度，以针对特定设备执行审计；如果使用此字段，则无需指定
                    browser_preset，因为它将被忽略；注意：要使用此参数，请将 enable_javascript 或
                    enable_browser_rendering 设置为 true；最小值（像素）：240；最大值（像素）：9999
                browser_screen_scale_factor:
                  type: number
                  description: >-
                    浏览器屏幕缩放系数；可选字段。您可以设置自定义浏览器屏幕分辨率比例，以针对特定设备执行审计；如果使用此字段，则无需指定
                    browser_preset，因为该参数将被忽略。注意：要使用此参数，请将 enable_javascript 或
                    enable_browser_rendering 设置为 true；最小值：0.5；最大值：3
                respect_sitemap:
                  type: boolean
                  description: >-
                    抓取时遵循站点地图；可选字段。如果希望抓取时按照主站点地图中指定的页面顺序，请设置为
                    true；默认值：false。注意：如果设置为 true，API 响应中的 click_depth 值将等于
                    0；请求中的 max_crawl_depth 字段将被忽略，您可以使用 max_crawl_pages
                    参数指定要抓取的页面数量
                custom_sitemap:
                  type: string
                  description: >-
                    自定义站点地图 URL，可选字段，即替代站点地图所在页面的
                    URL。注意：如果要使用此参数，respect_sitemap 应为 true
                crawl_sitemap_only:
                  type: boolean
                  description: >-
                    仅抓取站点地图中指定的页面；可选字段；如果只想抓取站点地图中指定的页面，请设置为 true；如果将此参数设置为 true
                    且未指定
                    custom_sitemap，我们将抓取默认站点地图；默认值：false；注意：如果要使用此参数，respect_sitemap
                    应为 true
                load_resources:
                  type: boolean
                  description: >-
                    加载资源；可选字段；如果要加载图片、样式表、脚本和损坏的资源，请设置为
                    true；默认值：false；注意：如果使用此参数，将产生额外费用；有关使用此参数的任务费用，请参阅我们的帮助文章；费用可以在定价页面上计算
                enable_www_redirect_check:
                  type: boolean
                  description: >-
                    检查域名是否实现 www 重定向。可选字段，如果要检查请求的域名是否实现从 www 到非 www 或从非 www 到
                    www 的重定向，请设置为 true；默认值：false
                enable_javascript:
                  type: boolean
                  description: >-
                    在页面上加载 JavaScript。可选字段。如果要加载页面上可用的脚本，请设置为
                    true。默认值：false。注意：使用此参数将产生额外费用；有关使用此参数的任务费用，请参阅我们的帮助文章；费用可在定价页面上计算
                enable_xhr:
                  type: boolean
                  description: >-
                    在页面上启用 XMLHttpRequest；可选字段；如果希望爬虫使用 XMLHttpRequest 对象从 Web
                    服务器请求数据，请将其设置为 true；默认值：false；如果使用此字段，enable_javascript
                    必须设置为 true；
                enable_browser_rendering:
                  type: boolean
                  description: >-
                    模拟浏览器渲染以测量 Core Web Vitals 可选字段
                    使用此参数可在加载网页时模拟浏览器；enable_browser_rendering
                    会加载页面上的样式、图像、字体、动画、视频及其他资源；默认值：false 设置为 true 可在响应中获取 Core
                    Web Vitals（FID、CLS、LCP）指标；如果使用此字段，enable_javascript 和
                    load_resources 参数必须设置为 true
                    注意：使用此参数会产生额外费用；有关使用此参数的任务费用，请参阅我们的帮助文章；具体费用可在 Pricing Page
                    上计算
                disable_cookie_popup:
                  type: boolean
                  description: >-
                    禁用 Cookie 弹窗 可选字段；如果要禁用请求用户同意使用 Cookie 的弹窗，请设置为
                    true；默认值：false
                custom_js:
                  type: string
                  description: "自定义 JavaScript，可选字段。请注意，此处输入脚本的最长执行时间应为 700 ms。例如，可以使用以下 JS 代码片段检查网站是否包含将 Google Tag Manager 作为 scr 属性：let meta = { haveGoogleAnalytics: false, haveTagManager: false };\r\nfor (var i = 0; i = 0)\r\n meta.haveGoogleAnalytics = true;\r\n\tif (src.indexOf(\"gtm.js\") >= 0)\r\n meta.haveTagManager = true;\r\n }\r\n}\r\nmeta;返回值取决于您在此字段中指定的内容。例如，如果指定以下脚本：meta = {}; meta.url = document.URL; meta.test = 'test'; meta; 则响应中将包含以下数据：\"custom_js_response\": { \"url\": \"https://dataforseo.com/\", \"test\": \"test\" } 注意：输入的脚本长度不得超过 2000 个字符。注意：使用此参数将产生额外费用；有关使用此参数的任务费用，请参阅我们的帮助文章；费用可在定价页面计算"
                validate_micromarkup:
                  type: boolean
                  description: >-
                    启用微数据验证；可选字段。如果要使用 OnPage API Microdata 端点，请设置为
                    true；默认值：false
                allow_subdomains:
                  type: boolean
                  description: 包含子域名上的页面，可选字段；如果要抓取目标网站的所有子域名，请设置为 true，默认值：false
                allowed_subdomains:
                  type: array
                  items:
                    type: string
                  description: >-
                    要抓取的子域名；可选字段；指定要抓取的子域名；示例：["blog.site.com", "my.site.com",
                    "shop.site.com"]；注意：要使用此参数，应将 allow_subdomains 参数设置为
                    false；否则，allowed_subdomains 字段的内容将被忽略，并返回所有子域名的结果
                disallowed_subdomains:
                  type: array
                  items:
                    type: string
                  description: >-
                    不抓取的子域名，可选字段。指定不希望抓取的子域名。示例：["status.site.com",
                    "docs.site.com"] 注意：要使用此参数，应将 allow_subdomains 参数设置为 true
                check_spell:
                  type: boolean
                  description: 检查拼写，可选字段；设为 true 时使用 Hunspell 库检查网站上的拼写；默认值：false
                check_spell_language:
                  type: string
                  description: >-
                    拼写检查的语言，可选字段。支持的语言：‘hy’、‘eu’、‘bg’、‘ca’、‘hr’、‘cs’、‘da’、‘nl’、‘en’、‘eo’、‘et’、‘fo’、‘fa’、‘fr’、‘fy’、‘gl’、‘ka’、‘de’、‘el’、‘he’、‘hu’、‘is’、‘ia’、‘ga’、‘it’、‘rw’、‘la’、‘lv’、‘lt’、‘mk’、‘mn’、‘ne’、‘nb’、‘nn’、‘pl’、‘pt’、‘ro’、‘gd’、‘sr’、‘sk’、‘sl’、‘es’、‘sv’、‘tr’、‘tk’、‘uk’、‘vi’。注意：如果未指定语言，系统将根据页面内容自动设置。
                check_spell_exceptions:
                  type: array
                  items:
                    type: string
                  description: >-
                    不进行拼写检查的单词，可选字段。指定要从拼写检查中排除的单词。单词最大长度：100
                    个字符；单词数量上限：1000。示例："SERP", "minifiers", "JavaScript"
                calculate_keyword_density:
                  type: boolean
                  description: >-
                    计算目标域名的关键词密度，可选字段。如果希望计算网站页面的关键词密度，请设置为
                    true。默认值：false。注意：使用此参数将产生额外费用；有关使用此参数的任务费用，请参阅我们的帮助文章。爬取完成后，您可以通过
                    Keyword Density 端点获取关键词密度值。
                checks_threshold:
                  type: object
                  description: >-
                    检查项的自定义阈值；这是一个可选字段，可用于为 OnPage API 响应的 checks
                    对象中包含的参数指定自定义阈值；注意：只能修改整数阈值；例如，high_loading_time 和
                    large_page_size 参数的默认值分别设置为 3 秒和 1 兆字节；如果要将这些阈值更改为 1 秒和 1000
                    千字节，请使用以下代码片段："checks_threshold": { "high_loading_time": 1,
                    "large_page_size": 1000
                    }可自定义的参数及其默认值："title_too_short"，默认值：30，类型："int"；"title_too_long"，默认值：65，类型："int"；"small_page_size"，默认值：1024，类型："int"；"large_page_size"，默认值：1048576
                    (1024 *
                    1024)，类型："int"；"low_character_count"，默认值：1024，类型："int"；"high_character_count"，默认值：256000
                    (250 *
                    1024)，类型："int"；"low_content_rate"，默认值：0.1，类型："float"；"high_content_rate"，默认值：0.9，类型："float"；"high_loading_time"，默认值：3000，类型："int"；"high_waiting_time"，默认值：1500，类型："int"；"low_readability_rate"，默认值：15.0，类型："float"；"irrelevant_description"，默认值：0.2，类型："float"；"irrelevant_title"，默认值：0.3，类型："float"；"irrelevant_meta_keywords"，默认值：0.6，类型："float"
                disable_sitewide_checks:
                  type: array
                  items:
                    type: string
                  description: >-
                    阻止运行特定的全站检查，可选字段。指定以下检查可阻止其在目标网站上运行："test_page_not_found"
                    "test_canonicalization" "test_https_redirect"
                    "test_directory_browsing"。示例："disable_sitewide_checks":
                    ["test_directory_browsing",
                    "test_page_not_found"]。更多信息请参阅我们的帮助中心。
                disable_page_checks:
                  type: array
                  items:
                    type: string
                  description: >-
                    阻止运行特定页面检查。可选字段，指定要阻止运行的特定检查，避免其影响
                    onpage_score。示例："disable_page_checks": ["is_5xx_code",
                    "is_4xx_code"]
                switch_pool:
                  type: boolean
                  description: >-
                    切换代理池，可选字段；如果为 true，将使用其他代理池获取请求的数据；当同时设置大量任务，偶尔出现限流和/或
                    site_unreachable 错误时，可以使用此参数
                return_despite_timeout:
                  type: boolean
                  description: >-
                    即使发生超时错误仍返回页面数据，可选字段；如果为 true，将提供未能在 120
                    秒内加载并返回超时错误的页面数据；默认值：false
                tag:
                  type: string
                  description: >-
                    用户定义的任务标识符。可选字段。字符数限制为 255。您可以使用此参数标识任务并将其与结果匹配；您将在响应的 data
                    对象中找到指定的 tag 值
                pingback_url:
                  type: string
                  description: >-
                    已完成任务的通知 URL。可选字段。任务完成后，我们将通过向您指定的 URL 发送 GET
                    请求来通知您。您可以使用字符串 ‘$id’ 作为 $id 变量，并使用 ‘$tag’ 作为经过 urlencoded
                    编码的 $tag
                    变量。我们会在发送请求前设置必要的值。示例：http://your-server.com/pingscript?id=$id
                    http://your-server.com/pingscript?id=$id&tag=$tag
                    注意：pingback_url 中的特殊字符将经过 urlencoded 编码；例如，# 字符将被编码为
                    %23。请在我们的帮助中心了解更多信息
              required:
                - target
                - max_crawl_pages
      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: 结果数组；在此情况下，该值将为 null
        '400':
          description: 错误请求
        '401':
          description: 未授权
        '429':
          description: 超出速率限制
        '500':
          description: 内部服务器错误
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````