extract-cite

中文文档
1.0.112发布于 2026/11/03rights.institute/PROSPERTypeScriptESM + CJS构建来源已验证

Cite any webpage: regex/metadata extraction of author, date, title and source, plus an optional LLM pass (OpenRouter by default) that completes the APA parts, scores confidence per field, flags fields for review, extracts author qualifications, and format

原始使用文档
文档目录5 节
  1. Slim default vs. extract-cite/full
  2. Content check
  3. What it will not do
  4. Moved from extract-webpage
  5. Demo

extract-cite

🤖 Agent skill — npx skills@latest add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill extract-cite (what it covers)

Cite any webpage. Two passes:

  1. extractCite: reads author, date, title and source straight off the HTML (meta tags, bylines, JSON-LD, URL patterns, and optionally a 92k-name database that tells people from organizations). Instant, offline, partial.
  2. extractCiteLLM: one model call (OpenRouter by default) that is given the partial citation and the parts still missing, completes the full APA citation, scores the confidence of every part, flags parts for review, and reads author qualifications from the page's bio. Output in APA 7, MLA 9, Chicago, Harvard, IEEE and BibTeX. The same call checks the content: is the extracted text the full article or a paywall stub, and which header, nav, sidebar and footer blocks to cut for readability.
bun add extract-cite
import { extractCiteLLM } from "extract-cite";

const cite = await extractCiteLLM({
  url: "https://www.npr.org/2023/12/28/1221827923/2023-hottest-year-record-climate-change",
  apiKey: process.env.OPENROUTER_API_KEY, // default provider: OpenRouter
  model: "anthropic/claude-haiku-4.5",    // default
  // baseUrl: "https://api.openai.com/v1" // any OpenAI-compatible API
});

cite.formatted.apa?.text;                  // full APA 7 entry
cite.formatted.mla?.html;                  // with <i> italics, HTML-escaped
cite.confidence;                           // { title: 0.98, publishedDate: 0.95, … }
cite.needsReview;                          // [{ field, confidence, reason }]
cite.citation.authors[0].qualifications;   // { jobTitle, affiliation, credentials, evidence, … }
cite.contentCheck?.verdict;                // "full" | "paywalled" | "truncated" | "blocked" | "not-article" | "unknown"
cite.contentCheck?.tips;                   // [{ region: "sidebar", selector: "aside.sidebar", example, tip }]
OptionDefault
url / html / textThe page. A url alone is fetched; pass html or text for sites that block servers.
apiKeyOPENROUTER_API_KEY
modelanthropic/claude-haiku-4.5
baseUrlhttps://openrouter.ai/api/v1
stylesallapa, mla, chicago, harvard, ieee, bibtex
reviewThreshold0.7Parts below this go in needsReview.
maxChars12000Page text sent to the model (head and tail).
contentpage textThe article you extracted (HTML or text, e.g. extract-webpage's html), for the content check.
checkContenttrueRun the content check in the same call.
contentWords3000Words of content the check reads, from the start.
fetchglobalReplaces fetch for both the page and the model call.

Slim default vs. extract-cite/full

The default entry is slim (~60 kB): it does not bundle the 92k human-names JSON (~1 MB), so person-vs-organization detection uses word heuristics only. To get the names database:

// Lazy-load it from the jsDelivr CDN (shared, cached; resolves null on failure)
import { extractCite, loadHumanNamesDB } from "extract-cite";
await loadHumanNamesDB(); // or { url, fetch } to self-host

// Or bundle it: same API, names database registered on import
import { extractCite } from "extract-cite/full";

setHumanNamesDB(db) registers a copy you already hold. Both entries share one database, so importing extract-cite/full once enables it for the slim import too.

Content check

The model reads the first contentWords words of content and an outline of the page's blocks (header.site-header (6 words) "Example Ledger Sign in…") and returns contentCheck: a verdict, the signals that show it ("Subscribe to continue reading"), a note for the reader, the contentSelector that holds the article body, and tips for the clutter the content still holds (header, nav, sidebar, footer, ads, related, newsletter, share, comments, cookie banner). selectors is the same as { content, remove }, the shape of an entry in extract-webpage's extract-selectors-per-domain.json. A verdict other than full also lands in needsReview as field: "content".

formatCitation(citation, style) and formatCitations(citation, styles) re-style a result offline.

What it will not do

The model's reply is not trusted. Text is fenced as untrusted data; strings are stripped of markup; dates must be real; an author whose name the page never prints is capped at 0.2 confidence and flagged; author qualifications need a verbatim quote that is on the page, or they are dropped. A part the page does not state comes back empty and flagged, not guessed. Content-check signals and examples must be in the text, and its selectors must match an element on the page, or they are dropped. Still: check needsReview before you cite.

Moved from extract-webpage

extractCite, convertURLToDomain and isURLValid used to live in extract-webpage (src/html-to-cite). That code moved here unchanged; extract-webpage re-exports those three, so existing imports keep working.

Demo

The Citation tab of the extract-pdf site (/demo#cite) runs this against news, journal, organization and blog URLs.

cd packages/extract-cite && bun run test

版本与发布记录

extract-cite 共发布 113 个版本,首次发布于 2026/10/05;过去 12 个月发布了 113 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.112latest2026/11/03今天
1.0.1112026/11/03今天
1.0.1102026/11/03今天
1.0.1092026/11/03今天
1.0.1082026/11/03今天
1.0.1072026/11/03今天

关于 extract-cite 的常见问题

extract-cite 是什么?

引用任何网页:regex/元数据提取作者,日期,标题和来源,加上一个可选的LLM通过(默认是OpenRouter),完成APA部分,每个字段的置信度评分,标记字段进行审查,提取作者资格和格式

如何安装 extract-cite?

在项目目录运行 npm install extract-cite,或使用 pnpm add / yarn add / bun add。

extract-cite 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

extract-cite 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

extract-cite 可以商用吗?

extract-cite 使用 rights.institute/PROSPER 许可。声明的许可为 rights.institute/PROSPER,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

extract-cite 还在维护吗?

最新版本 1.0.112 发布于 2026/11/03(今天);至今共发布 113 个版本,其中过去 12 个月发布了 113 个;首次发布于 2026/10/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。