extractDataEfficient method

List<String> extractDataEfficient({
  1. required String html,
  2. required String selector,
  3. String? attribute,
  4. bool asText = true,
  5. int chunkSize = 1024 * 1024,
})

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,
  );
}