extractStructuredMetadata method
List<StructuredDataExtractionResult>
extractStructuredMetadata({
- required String html,
- StructuredDataType? type,
Extracts structured data from HTML using JSON-LD, Microdata, RDFa, etc.
html
is the HTML content to parse
type
is the type of structured data to extract (default: all)
Implementation
List<StructuredDataExtractionResult> extractStructuredMetadata({
required String html,
StructuredDataType? type,
}) {
try {
if (type != null) {
return _structuredDataExtractor.extractByType(html, type);
} else {
return _structuredDataExtractor.extractAll(html);
}
} catch (e) {
_logger.error('Failed to extract structured metadata: $e');
return [];
}
}