API: extraction/readability
better-web-search-mcp / extraction/readability
extraction/readability#
Interfaces#
ReadabilityResult#
Defined in: src/extraction/readability.ts:15
The result of a readability extraction.
Properties#
| Property | Type | Description | Defined in |
|---|---|---|---|
byline | string | Author metadata, when present. | src/extraction/readability.ts:27 |
contentMarkdown | string | The article content converted to Markdown. | src/extraction/readability.ts:19 |
excerpt | string | A short excerpt / description of the article. | src/extraction/readability.ts:23 |
length | number | Length of the article in characters. | src/extraction/readability.ts:25 |
textContent | string | Plain-text content with all HTML tags removed. | src/extraction/readability.ts:21 |
title | string | The article title. | src/extraction/readability.ts:17 |
Functions#
extractWithReadability()#
extractWithReadability(
html,url):ReadabilityResult|null
Defined in: src/extraction/readability.ts:47
Extract the main article from an HTML page.
- Cheerio pre-pass removes script/style/link/svg/data-image nodes so they never pollute the article or the Markdown output.
- The cleaned HTML is loaded into JSDOM (with the page URL for correct relative-link resolution).
- Mozilla Readability parses the document into an article.
- Turndown converts the article HTML to Markdown.
Returns null when the page has no readable article (Readability.parse
returns null), so callers can escalate to a different extraction tier.
Parameters#
| Parameter | Type |
|---|---|
html | string |
url | string |
Returns#
ReadabilityResult | null