Skip to content

Commit d7aac14

Browse files
fix: fall back to cleaned HTML when Readability extracts no content (#125)
1 parent 9a04f1e commit d7aac14

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/website-content-crawler/text-extractor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export async function readableText({
3636

3737
const readabilityRoot = parsed?.content as HTMLElement | null;
3838

39+
if (options?.fallbackToNone && !readabilityRoot?.textContent?.trim()) {
40+
return html;
41+
}
42+
3943
if (readabilityRoot && parsed?.title) {
4044
const titleElement = dom.window.document.createElement('h1');
4145
titleElement.textContent = parsed.title;

0 commit comments

Comments
 (0)