-
Notifications
You must be signed in to change notification settings - Fork 615
/
index.d.ts
64 lines (53 loc) · 1.64 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* Decides whether or not the document is reader-able without parsing the whole thing.
* @return {boolean} Whether or not we suspect Readability.parse() will suceeed at returning an article object.
*/
export function isProbablyReaderable(
document: Document,
options?: {
/** The minimum node content length used to decide if the document is readerable. */
minContentLength?: number;
/** The minumum cumulated 'score' used to determine if the document is readerable. */
minScore?: number;
/** The function used to determine if a node is visible. */
visibilityChecker?: (node: Node) => boolean;
}
): boolean;
export class Readability<T = string> {
constructor(
document: Document,
options?: {
debug?: boolean;
maxElemsToParse?: number;
nbTopCandidates?: number;
charThreshold?: number;
classesToPreserve?: string[];
keepClasses?: boolean;
serializer?: (node: Node) => T;
disableJSONLD?: boolean;
allowedVideoRegex?: RegExp;
}
);
parse(): null | {
/** article title */
title: string;
/** HTML string of processed article content */
content: T;
/** text content of the article, with all the HTML tags removed */
textContent: string;
/** length of an article, in characters */
length: number;
/** article description, or short excerpt from the content */
excerpt: string;
/** author metadata */
byline: string;
/** content direction */
dir: string;
/** name of the site */
siteName: string;
/** content language */
lang: string;
/** published time */
publishedTime: string;
};
}