extractDataEfficient method
Extracts data using memory-efficient parsing for large HTML documents
html
is the HTML content to parse
selector
is the CSS selector to use
attribute
is the attribute to extract (optional)
asText
whether to extract the text content (default: true)
chunkSize
is the size of each chunk to process (default: 1024 * 1024 bytes)
Implementation
List<String> extractDataEfficient({
required String html,
required String selector,
String? attribute,
bool asText = true,
int chunkSize = 1024 * 1024, // 1MB chunks
}) {
_logger.info(
'Using memory-efficient extraction for HTML (${html.length} bytes)',
);
return _memoryEfficientParser.extractData(
html: html,
selector: selector,
attribute: attribute,
asText: asText,
chunkSize: chunkSize,
);
}