Skip to content

Commit e8d6c1c

Browse files
authored
feat: eager discover readable content (#9)
1 parent af7cf12 commit e8d6c1c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/content/read.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { InboxEntryInput } from "@/types";
2-
import { Readability, isProbablyReaderable } from "@mozilla/readability";
2+
import { Readability } from "@mozilla/readability";
33
import DOMPurify from "dompurify";
4+
45
export interface ReaderInfo extends NonNullable<ReturnType<Readability["parse"]>> {
56
pured: string;
67
}
78

89
export function getReaderInfo(): ReaderInfo | false {
9-
const isReaderable = isProbablyReaderable(document);
10-
if (!isReaderable) return false;
11-
const p = new Readability(document.cloneNode(true) as Document).parse()!;
10+
const p = new Readability(document.cloneNode(true) as Document).parse();
11+
if (!p) return false;
12+
1213
const pured = DOMPurify.sanitize(p?.content || "");
1314
return { ...p, pured };
1415
}

0 commit comments

Comments
 (0)