File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { InboxEntryInput } from "@/types" ;
2
- import { Readability , isProbablyReaderable } from "@mozilla/readability" ;
2
+ import { Readability } from "@mozilla/readability" ;
3
3
import DOMPurify from "dompurify" ;
4
+
4
5
export interface ReaderInfo extends NonNullable < ReturnType < Readability [ "parse" ] > > {
5
6
pured : string ;
6
7
}
7
8
8
9
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
+
12
13
const pured = DOMPurify . sanitize ( p ?. content || "" ) ;
13
14
return { ...p , pured } ;
14
15
}
You can’t perform that action at this time.
0 commit comments