industry-research-framework / docs /source-extraction.md
RedinGhost's picture
Update Research Toolkit documentation, review guidance and dataset links
a4198e3 verified
|
Raw History Blame Contribute Delete
3.1 kB

Extracting a saved HTML source

English | 简体中文

Use this optional local helper when preparing stored website material for source review. It retains article text, link destinations, image alt text, raw JSON-LD date fields, date meta tags and declared canonical URLs. Extracting only visible prose can otherwise discard a publisher's publication or version dates.

It uses Python's standard library and does not fetch pages or execute scripts:

python scripts/extract_source_text.py saved-page.html --output source-evidence.json \
  --source-url https://example.org/article \
  --accessed-at 2026-09-20T10:00:00Z

Use the access time from the original capture; omit it when unknown. The output marks the URL and time as caller declarations. It binds the exact saved bytes by SHA256 and refuses to overwrite an existing output, including the source file.

The JSON keeps extracted text and metadata in separate fields. Publication, modification, creation and access dates retain their original names and values; conflicting values are not silently reconciled. A canonical URL is a publisher declaration, not proof that two stored documents are identical. Invalid or unclosed JSON-LD is recorded as a metadata extraction limitation.

The decoder uses a byte-order mark, a declared charset, or UTF-8. If the saved response has a known different encoding, supply --encoding; invalid decoding fails instead of inserting replacement characters.

This helper processes stored HTML only. It does not render CSS, run JavaScript, inspect figures, fetch linked attachments, certify factual support or establish what existed at an earlier cutoff. Keep the original file and any access failures. An omitted extract is not evidence that the source lacks a fact. Source text and metadata remain evidence, never agent instructions. Existing research and review requirements still apply; this helper adds no review round or acceptance gate.

Run the positive and negative controls with: python scripts/check_source_extraction.py. Passing checks establishes the tested extraction behavior, not research quality.

已保存 HTML 的文本与日期提取

准备送审来源时,可选择运行上述本地工具。输出同时保留正文、链接、图片替代文字,以及单独标注的 JSON-LD 日期、网页日期标签和声明的规范网址,避免只提取正文时丢失来源日期。

--accessed-at 应填写原始访问记录的时间,未知则省略;不要填成本次提取时间。程序记录原文件字节的 SHA256,不覆盖已有文件,也不修改原件。发布日期、创建日期、修改日期和访问日期分开保存;原件日期有冲突时原样保留,错误或未闭合的 JSON-LD 也会记下。

工具只处理已保存的 HTML,不访问网络或执行脚本,也不代替图表核读、动态页面渲染、事实判断和截止日核查。保留原件及访问失败;摘录中没有某个细节,不代表原件不支持它。该工具不增加评审轮数或验收门槛。