shrink-dom
Version:
适用于网页分析、内容提取、AI训练数据准备和网页爬虫等场景,帮助开发者更高效地处理和优化DOM结构。
37 lines (36 loc) • 1.24 kB
TypeScript
export declare class DOMDomainAnalyzer {
private annotatedElements;
private interactiveElements;
private annotationAttribute;
private minInteractiveSize;
private highlightStyle;
private highlightDuration;
private enableHighlight;
private static readonly DEFAULT_CONFIG;
static readonly INTERACTIVE_TAGS: string[];
static readonly INTERACTIVE_INPUT_TYPES: string[];
static readonly INTERACTIVE_ROLES: string[];
static readonly NON_EDITABLE_INPUT_TYPES: string[];
static readonly ELEMENT_NODE = 1;
constructor(options?: {
annotationAttribute?: string;
minInteractiveSize?: number;
highlightStyle?: string;
highlightDuration?: number;
enableHighlight?: boolean;
});
getElements(): HTMLElement[];
private isElementVisible;
private isElementInteractive;
private isElementEditable;
private traverseNode;
private highlightInteractiveElements;
getAnalyzedHTML(element?: HTMLElement): string;
static analyze(options?: {
annotationAttribute?: string;
minInteractiveSize?: number;
highlightStyle?: string;
highlightDuration?: number;
enableHighlight?: boolean;
}): string;
}