什么是软阻断?
Scrapeless Web Unlocker 可获取目标页面内容,并支持 JavaScript 渲染,适用于依赖浏览器执行的采集任务。
软阻断在网页采集中的含义是什么?
软阻断是一个非正式术语,指的是通过返回的内容或流程而非明显的传输失败表现出来的访问限制。一次请求可能收到看起来正常的响应,但目标数据仍然不可用。验证中间页就是一个常见示例。
该术语是有用的运营速记,但它并不是协议标准中定义的 HTTP 状态码。团队应该记录清楚其自身分类器所称的软阻断究竟指什么。否则,仪表盘可能会把安全挑战、认证页面、空搜索结果和渲染失败混入一个具有误导性的类别。
HTTP 语义 描述对请求的响应;它们并不保证返回的表示满足特定的抽取任务。HTTP 200 只能说明服务器选择发送的页面成功交付。你的应用仍需要确认自己收到了期望的内容。
要点概览
- 软阻断可以伴随 HTTP 200 一起出现。 传输成功与内容成功是不同的观测结果。
- 空结果需要正向证据支撑。 仅凭缺失记录无法区分真实的空状态与采集失败。
- 内容检查应结合多种信号。 URL、页面身份、必需字段和挑战证据都能提供上下文。
- 不确定的响应应保持未决状态。 不要用莫名其妙的空抽取结果替代有效的业务数据。
软阻断长什么样?
软阻断可能表现为验证页面、占位屏幕,或其他打断预期内容路径的页面表示。关键特征是在请求的业务内容与采集流程可用的响应之间存在不匹配。
浏览器可能显示一个要求访问者完成验证的页面。HTTP 客户端可能收到一份完整的 HTML 文档,但其标题和正文属于该验证页面。解析器可以在不报错的情况下处理该文档,却仍然提取不到任何必需记录。
有些响应是模棱两可的。空白的应用外壳可能源于缺失的 JavaScript 执行。登录表单可能反映正常的账号要求。授权同意页面可能是合法区域流程的一部分。在证据允许的情况下,将这些状态分别分类;它们的解决方式和权限含义各不相同。
一个包含预期页面标题却缺少记录的响应同样需要调查。数据可能通过单独请求加载,选择器可能已经变化,或者来源确实没有匹配记录。避免把每一次抽取失败都视为有意的安全动作。
软阻断与其他空结果的区别
软阻断不同于真正的空数据集,因为流程缺乏确认证据来证明预期查询或页面已经正常完成。正向的空状态证据通常比仅仅缺少某个元素选择器更具信息量。
| 观测结果 | 可能的解释 | 下一步要检查的证据 |
|---|---|---|
| 验证文案替代了记录 | 访问挑战 | 页面身份、最终 URL、挑战界面 |
| 没有内容的应用外壳 | 渲染或数据加载问题 | 必需脚本、网络活动、页面就绪状态 |
| 明确的“无结果”消息 | 可能是有效的空查询 | 查询、地区、筛选条件、正常页面身份 |
| 登录表单 | 认证要求 | 允许的账号状态和预期访问路径 |
| 在已填充页面上选择器不匹配 | 抽取器不再匹配当前布局 | 当前标记结构以及针对该站点的字段映射 |
状态码可以补充证据,但无法单独决定类别。当服务器明确拒绝访问时,硬性拒绝更容易识别,但仍然值得检查响应体和落地点。应依据完整的观测结果,而不是孤立的某一个字段。
应如何定义内容成功?
内容成功应意味着响应代表了所请求的来源,并且包含下游任务所需的证据。在收集大规模数据集之前先定义好这一契约。
对于商品详情页,该契约可能要求预期的商品标识、可识别的商品标题,以及价格或明确的“价格不可用”状态。对于搜索页,它可能要求请求的查询上下文,以及记录或正常的空状态消息二者之一。这些只是示例性的校验选择,而非通用模式。
既要校验字段含义也要校验字段存在。站点页脚中的货币符号不是商品价格。带有类似商品标识的导航链接也不一定就是所请求的记录。优先使用字段之间与来源相关的特定关系,而不是松散收集的一堆通用词语。
将可选字段与必需字段区分开来。缺少可选图片不一定要拒绝一条其他方面可用的记录。缺少商品标识则应当阻止结果被错误地关联到某个实体。验证契约决定哪种结果是合适的。
构建一个有用的响应分类器
一个有用的响应分类器会将肯定性的内容证据与已知的替代状态证据相结合。当现有证据不足以支持有把握的结论时,它应产生一个未解决的类别。
- 检查最终目的地。 在假定请求的 URL 仍然是目标之前,请先确认预期的主机名和路由。
- 确认页面身份。 寻找预期的实体、查询或文档结构。通用站点框架只是较弱的证据。
- 检查备用状态。 请提供需要翻译的英文文本。
- 验证必填字段。 在接受一条记录之前,请检查类型、关系以及预期含义。
- 请提供需要从英文翻译为中文(zh)的具体文本。 在无法得出明确结论时,保留未解决的结果及其证据,而不是强行将其归类为“成功”或“无数据”。
短语匹配需要语境。一篇关于验证码的文章很可能会合理地包含“验证你是人类”这样的字句。简单的文本短语匹配会将那篇文章误判。需要将该短语与结构性证据、页面标识以及预期内容的缺失结合起来进行判断。
Pagination labels and controls This article provides details about items that appear in the Pagination page template. The pagination page template can be used to set labels and styles for the pagination on listing pages and post list blocks, as well as block styles for the post navigation block which controls the “Previous”, “Next” and numbered page selector (if in use).   Pagination This section controls the appearance and labelling of the **pagination block**, which can can be individually controlled within any listing page, like the blog or search results template for example, or within a “Post List” block. For both of these, the pagination block can be used inside that block to provide numbered (or otherwise) page controls. For consistency, you can use the Pagination Template controller page to control how all blocks of this type look across the site.  Buttons The “Buttons” controls in the pagination page controls the styling of the numbered (or other style) buttons used in numbered pagination controls. Type options There are five options for the type of pagination button used: - **Number** – numbered buttons from “1” to max number of pages - **Square Dot** – square “pill shaped” button with a hollow circular center - **Button Dot** – solid rounded-dot - **Icon** – icon you can select, with wide range of options - **Custom CSS** – with an advanced knowledge of development, you can use this option to provide your own HTML and CSS styling Numbers - **Enable Numbers** — if using dots or icon button types, this will control whether the page number is displayed in addition to the standard shape. - **Show first number** — show the first page option within the pagination - **Show last number** — show the last page option within the pagination - **Leading numbers** — controls how many numbered pips or buttons to show before the current page - **Appearance** — controls whether the “buttons” are displayed as always visible on desktop, or only shown when a hover takes place. Spacing - Horizontal Spacing — controls the amount of space between the buttons - Vertical spacing — controls the “height” of the button, with additional height meaning a bigger button, but text stays in the same place - Border radius — controls the roundness of corners for the buttons Icons - Size scale — when you use icon based buttons, this controls the relative size of the icon to the space provided for those controls. Appearances Buttons are controlled by a separate part of the WordPress experience, which lets you set different “appearances” which are collections of styles. The block pulls in a set of styles based upon the currently active “appearance”. - Appearance selector — the “< >” (left/right chevron) control lets you cycle through the different appearance style variants (“filled, outline, soft, plain…”) as well any “custom” variations that might have been created. - Font — lets you change the font used in the pagination, which will operate independently of the rest of the site appearance settings - Size — the size of the font used in the pagination section. - Shape — lets set the border style, and the shape of the pagination “buttons” - Spacing — controls the declared height of the buttons, with larger “spacing” they will be taller (more whitespace). - Border — set the border style and thickness - Radius — rounding of the corners for the buttons, set this high to have pretty circular buttons (if the height is set to reasonable amount) - Styles on interaction - Opacity - Text decoration - Overlay How pagination works To understand how the Pagination template is applied to the site, it’s useful to have some additional context about where it might appear: - On the “Blog” or “Posts” page, for any post type which is currently using pagination - On the “Archive” pages for various taxonomies: - Categories Pages - Tag pages - Author pages - Inside a “Post list” block which displaying a series of posts (like our recent articles below) - In search results Examples of the different types  Pagination labels “Next page label”, “Previous page label” and “Page number label” provide controls for how you would like the labels to be read when using a screen reader or other assistive device. If these are left blank, we provide default values for these labels which are also helpful for screen readers. - **Next page label** — controls how the “Next” control is declared in screen readers. - **Previous page label** — controls how the “Previous” control is declared in screen readers. - **Page number label** — controls the individual page labels, with some formats available: - @@INLINECODE_0@@ — the current page number - @@INLINECODE_1@@ — the total number of pages - @@INLINECODE_2@@ — a variable which holds the target (individual) page of a control, for example “Page 2” When these labels are used, they could be read out in a way which might sound like “Current page 2 of 10”. The default values for these fields are: - Next Page - Previous page - Page @@INLINECODE_3@@ of @@INLINECODE_4@@ Post navigation styles The post navigation options control how the Previous/Next controls are displayed at the foot of individual post pages.  Layout Controls layout for the Post navigation, with options for: - Space between controls - Justification of controls - Vertical alignment of controls Previous label This affects what is shown for the “Title” of the previous post. Only visible if the “Show categories & dates” option (see next section) is turned off. - Show label - If enabled, label tex will appear above the “Title” of the previous post which is shown. - If disabled, no text will appear above the post “Title” - Label text — the value that appears if “Show label” is enabled. Next label This affects what is shown for the “Title” of the next post. Only visible if the “Show categories & dates” option (see next section) is turned off. - Show label - If enabled, label tex will appear above the “Title” of the next post which is shown. - If disabled, no text will appear above the post “Title” - Label text — the value that appears if “Show label” is enabled. By default, the “Previous/Next” labels show the text “Previous post” and “Next post”. Styles Controls how the “Previous” and “Next” blocks are displayed. - Show titles — controls whether the underlying post title is displayed inside the navigation control. - Show arrows — controls whether an arrow is shown on the right or left side of this block. - Arrow icon — depending on whether this is “previous” or “next” the “Left arrow” or “right arrow” controls which “arrow style” they use from a pre-populated list - Direction - Auto — lets you use the icons from the previous part of the controls which we just mentioned - Right to left — which is useful for RTL languages or situations where this may be preferable from a design perspective for consistency. - Orientation - Vertical — shows the post title underneath the arrow, with whichever label being used above that title. - Horizontal — shows the arrow showing inline with the label, and previous/next post title. Examples of the orientation choices   Typography Controls how the text in the “Previous/Next” block, affecting each of the “typographical” controls listed, including: - Font family - Font size - Letter case (uppercase, lowercase) - Letter spacing - Line height Labels Shows the same options for the “Previous/Next” labels as we saw earlier, but used for blocks. - Show label - Label text Colors Allows you to alter the colors used for text, background and link colors. These settings are provided by the Appearance template directly. Border & Radius Controls the border style of the blocks, including the “Thickness” and “Color” along with the radius of the corners. Padding & margin Controls the spacing inside and outside of these blocks: - Padding — space inside the edges of the blocks - Margin — space outside of the blocks Previous/Next labels The “Previous post label” and “Next post label” fields control how this will be announced to screen readers. - **Previous post label** — the default for this string is “Previous post:” - **Next post label** — the default for this string is “Next post:” Using these fields, it might be common to add the words “Article” or “Story” on the end. As a best practice, in terms of helping screen reader users understand how items are related, keeping the trailing colon helps in announcing the context, for example: “Previous post: Complex series of words that are very long” with the use of the colon helping provide a useful divider or breakpoint between the functional part of the string, and the contextual title.
应如何检查动态渲染?
应通过应用程序的内容就绪情况来检查动态渲染,而不是仅仅依赖页面加载这一里程碑。文档可能会在其数据出现之前加载完成,而页面也可能在其有用内容已就绪之后仍然继续进行后台网络活动。
The HTML 处理模型 将文档解析与脚本执行分离。当前一个 HTTP 响应包含一个稍后由浏览器填充的外壳时,这一区别很重要。在识别安全阻断之前,对比初始响应与渲染结果。
使用页面的必需内容作为就绪目标。需要产品标题的任务应当确认该标题及其关联身份。任意的延迟可能会在一次运行中隐藏问题,而在另一次运行中导致失败。通用的加载事件是浏览器的一个里程碑,而不是针对每个应用程序数据的契约。
The Web Unlocker JavaScript 渲染选项 描述受支持的渲染界面。当允许的页面需要 JavaScript 时选择它,然后验证返回的结果。启用渲染并不意味着已满足所有访问条件。
保护下游数据集
通过将采集状态与业务状态分离来保护下游数据集。“采集未生成经过验证的价格”不应自动变成“该商品没有价格”或“该商品不可用”。
将先前有效的观测结果与失败的采集尝试分开保存。保留其原始观测时间和来源上下文,以便读者了解其时效性。未解决的新尝试应产生运行告警或进入审核状态,而不是在无提示的情况下静默替换之前的值。
安全屏幕可能包含请求标识符和会话信息。仅保留诊断所需的已净化证据。截图可能会有用,但在将其附加到共享工单之前,请检查其中是否包含账户详细信息。
当所有者策略限制访问时,请使用已批准的信息源或请求集成支持。 机器人排除协议 传达的是爬虫指令,并不授予访问授权。技术上可被检索到的响应与被允许的收集任务是两个独立的要求。
评估集合服务
根据你的任务检查标准来评估一个收集服务,看它是否返回通过这些检查的内容。 Scrapeless Web Unlocker 产品 提供了一种基于 URL 的集合选项,而你的应用程序定义预期内容并处理未解析状态。
比较 Scrapeless 定价 具有代表性的许可工作负载所产生的可用数据量。服务提供方在请求层面的结果与你在业务层面的接受标准可能会不一致。记录二者,而不是用一个单一的成功计数器把其中一个隐藏起来。
相关讨论 网络收集实践 提供更广泛的浏览器上下文。使用当前文档作为实现设置的依据,并保留您自己的验证约定作为验收标准。
结论
软阻塞是一种内容或工作流问题,它可以隐藏在正常的 HTTP 响应之后。确认页面身份,区分不同的替代状态,并对有数据和无数据的结果都要求提供证据。在未解决之前,将不确定的采集结果排除在业务数据之外。
构建一个可供你验证的工作流
选择与您被允许的数据源相匹配的 Scrapeless 服务,然后根据您的应用所需字段检查返回的内容。
今天注册即可获得 $5 免费额度 — 无需信用卡.
领取您的 $5 额度 →常见问题
问:HTTP 200 会是软封锁(soft block)吗?
当服务器成功返回挑战页面或其他页面而不是预期内容时,HTTP 200 也可能伴随软封锁。在接受结果前,请先检查返回内容的结构。
问:空数组能证明被封锁了吗?
空数组不能证明一定被封锁。它也可能表示合法的空查询、解析问题、缺少渲染或内容不可用。
问:是否应该仅凭挑战用语来决定类别?
仅凭挑战用语不足以判断,因为普通文章也可能包含相同的词语。需要将结构性证据与预期页面身份及所需字段结合起来。
问:当结果不确定时应该怎么办?
当结果不确定时,应保持该状态未解决,并保留经过脱敏的诊断证据。不应以未经验证的空值悄然覆盖原本有效的观测结果。