/** * Structured Data Extractor * * Comprehensive extraction of structured metadata from HTML pages. * Inspired by Python's extruct library, supports multiple formats: * * - JSON-LD (Google's preferred format) * - Microdata (schema.org HTML5 attributes) * - OpenGraph (Facebook meta tags) * - Twitter Cards (Twitter meta tags) * - Dublin Core (Document metadata) * - RDFa Lite (Resource Description Framework) * * @see https://github.com/scrapinghub/extruct * @see https://schema.org/ * @see https://ogp.me/ */ /** * Extracted structured data result */ export interface StructuredDataResult { /** JSON-LD structured data */ jsonLd: JsonLdItem[]; /** Microdata items */ microdata: MicrodataItem[]; /** OpenGraph metadata */ openGraph: OpenGraphData; /** Twitter Card metadata */ twitterCard: TwitterCardData; /** Dublin Core metadata */ dublinCore: DublinCoreData; /** RDFa Lite items */ rdfa: RdfaItem[]; /** Combined/normalized product data (if applicable) */ product?: ProductData; /** Combined/normalized article data (if applicable) */ article?: ArticleData; /** Combined/normalized organization data (if applicable) */ organization?: OrganizationData; /** Raw meta tags */ meta: Record; } export interface JsonLdItem { '@context'?: string; '@type': string; [key: string]: unknown; } export interface MicrodataItem { type: string; properties: Record; } export interface OpenGraphData { title?: string; type?: string; url?: string; image?: string | string[]; description?: string; siteName?: string; locale?: string; [key: string]: unknown; } export interface TwitterCardData { card?: string; site?: string; creator?: string; title?: string; description?: string; image?: string; [key: string]: unknown; } export interface DublinCoreData { title?: string; creator?: string; subject?: string; description?: string; publisher?: string; contributor?: string; date?: string; type?: string; format?: string; identifier?: string; source?: string; language?: string; relation?: string; coverage?: string; rights?: string; } export interface RdfaItem { typeof: string; properties: Record; } /** * Normalized product data from any structured data source */ export interface ProductData { name?: string; description?: string; brand?: string; sku?: string; gtin?: string; mpn?: string; price?: number; priceCurrency?: string; availability?: string; condition?: string; image?: string | string[]; url?: string; rating?: { value: number; count: number; best?: number; }; reviews?: Array<{ author?: string; rating?: number; text?: string; date?: string; }>; category?: string; offers?: Array<{ price: number; currency: string; seller?: string; availability?: string; }>; } /** * Normalized article data from any structured data source */ export interface ArticleData { headline?: string; description?: string; author?: string | string[]; datePublished?: string; dateModified?: string; publisher?: string; image?: string | string[]; wordCount?: number; articleBody?: string; section?: string; keywords?: string[]; } /** * Normalized organization data */ export interface OrganizationData { name?: string; url?: string; logo?: string; description?: string; address?: string; phone?: string; email?: string; sameAs?: string[]; } /** * Extract all structured data from HTML */ export declare function extractStructuredData(html: string, baseUrl?: string): StructuredDataResult; /** * Check if page has any structured data */ export declare function hasStructuredData(html: string): boolean; /** * Quick check for product structured data */ export declare function hasProductData(html: string): boolean; /** * Quick check for article structured data */ export declare function hasArticleData(html: string): boolean; export default extractStructuredData; //# sourceMappingURL=structured-data-extractor.d.ts.map