Expand description
内容指纹与 AMP 检测模块
提供内容指纹生成、变化检测、AMP 页面识别和缓存提示提取功能。 改编自 halldyll-parser 的指纹与 AMP 检测实现。
Structs§
- AmpInfo
- AMP 页面信息
- Cache
Hints - 缓存提示信息
- Content
Fingerprint - 内容指纹,用于检测 HTML 内容的变化
Functions§
- content_
similarity - 计算两个 HTML 文档的内容相似度
- count_
elements - 统计文档中的 HTML 元素总数
- count_
text_ nodes - 统计文档中的文本节点数量
- detect_
amp_ runtime - 检测页面是否加载了 AMP 运行时
- detect_
amp_ version - 检测 AMP 版本号
- detect_
is_ amp_ page - 检测当前页面是否为 AMP 页面
- extract_
amp_ components - 提取页面使用的 AMP 扩展组件列表
- extract_
amp_ info - 从 HTML 文档中提取 AMP 信息
- extract_
amp_ link - 提取 AMP 版本的链接(
<link rel="amphtml">) - extract_
cache_ hints - 从 HTML 文档中提取缓存提示信息
- extract_
canonical_ link - 提取 canonical 链接(
<link rel="canonical">) - extract_
main_ content - 从文档中提取主要正文内容
- extract_
structure - 提取文档的结构指纹(基于 DOM 标签层次结构)
- extract_
text_ only - 从文档中提取所有文本(不含 HTML 标签)
- fingerprint_
document - 为 HTML 文档生成指纹
- generate_
fingerprint - 为 HTML 文档生成完整的内容指纹
- get_
amp_ url - 获取 AMP 版本的 URL(如果存在)
- has_
content_ changed - 检查两个 HTML 文档的内容是否发生了变化
- hash_
string - 计算字符串的哈希值
- is_
amp_ page - 检测 HTML 文档是否为 AMP 页面
- quick_
hash - 快速计算文本内容的哈希值
- quick_
html_ hash - 快速计算 HTML 文档的文本哈希值
- resolve_
url - 解析相对 URL 为绝对 URL