metanova 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +263 -0
- package/USAGE_GUIDE.md +829 -0
- package/dist/index.cjs +3756 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +493 -0
- package/dist/index.d.ts +493 -0
- package/dist/index.js +3674 -0
- package/dist/index.js.map +1 -0
- package/examples/behance.mjs +23 -0
- package/examples/commonjs.cjs +12 -0
- package/examples/custom-adapter.mjs +41 -0
- package/examples/custom-plugin.mjs +26 -0
- package/examples/diagnostics.mjs +17 -0
- package/examples/live-fetch.mjs +21 -0
- package/examples/parse-html.mjs +15 -0
- package/examples/pinterest.mjs +22 -0
- package/examples/preview-card.mjs +11 -0
- package/examples/quick-start.mjs +24 -0
- package/examples/reddit.mjs +23 -0
- package/examples/social-links.mjs +28 -0
- package/examples/social-preview.mjs +21 -0
- package/examples/youtube-playlist.mjs +19 -0
- package/examples/youtube-video.mjs +22 -0
- package/examples/youtube.mjs +22 -0
- package/package.json +70 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import { CheerioAPI } from 'cheerio';
|
|
2
|
+
|
|
3
|
+
type MetadataType = "website" | "article" | "image" | "product" | "video" | "playlist" | "audio" | "social_post" | "profile" | "app" | "unknown";
|
|
4
|
+
type MediaKind = "image" | "video" | "audio" | "favicon";
|
|
5
|
+
type MetadataSource = "html" | "openGraph" | "twitter" | "jsonLd" | "oEmbed" | "adapter" | "plugin" | "fallback" | "favicon";
|
|
6
|
+
interface MediaAsset {
|
|
7
|
+
url: string;
|
|
8
|
+
kind: MediaKind;
|
|
9
|
+
source: MetadataSource | string;
|
|
10
|
+
secureUrl?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
alt?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
poster?: string;
|
|
17
|
+
score?: number;
|
|
18
|
+
confidence?: number;
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
interface Entity {
|
|
22
|
+
name?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
logo?: string;
|
|
25
|
+
sameAs?: string[];
|
|
26
|
+
}
|
|
27
|
+
interface ArticleMetadata {
|
|
28
|
+
headline?: string;
|
|
29
|
+
section?: string;
|
|
30
|
+
tags?: string[];
|
|
31
|
+
publishedTime?: string;
|
|
32
|
+
modifiedTime?: string;
|
|
33
|
+
expirationTime?: string;
|
|
34
|
+
authors?: Entity[];
|
|
35
|
+
publisher?: Entity;
|
|
36
|
+
}
|
|
37
|
+
interface ProductMetadata {
|
|
38
|
+
name?: string;
|
|
39
|
+
brand?: Entity;
|
|
40
|
+
sku?: string;
|
|
41
|
+
price?: string;
|
|
42
|
+
currency?: string;
|
|
43
|
+
availability?: string;
|
|
44
|
+
condition?: string;
|
|
45
|
+
ratingValue?: number;
|
|
46
|
+
reviewCount?: number;
|
|
47
|
+
}
|
|
48
|
+
interface ApplicationMetadata {
|
|
49
|
+
name?: string;
|
|
50
|
+
category?: string;
|
|
51
|
+
operatingSystem?: string;
|
|
52
|
+
price?: string;
|
|
53
|
+
currency?: string;
|
|
54
|
+
}
|
|
55
|
+
interface VideoMetadata {
|
|
56
|
+
id?: string;
|
|
57
|
+
title?: string;
|
|
58
|
+
channel?: Entity;
|
|
59
|
+
publishedTime?: string;
|
|
60
|
+
duration?: string;
|
|
61
|
+
tags?: string[];
|
|
62
|
+
category?: string;
|
|
63
|
+
viewCount?: number;
|
|
64
|
+
}
|
|
65
|
+
interface PlaylistVideo {
|
|
66
|
+
id: string;
|
|
67
|
+
title?: string;
|
|
68
|
+
url: string;
|
|
69
|
+
}
|
|
70
|
+
interface PlaylistMetadata {
|
|
71
|
+
id?: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
channel?: Entity;
|
|
74
|
+
videos: PlaylistVideo[];
|
|
75
|
+
}
|
|
76
|
+
interface MetadataSourceAttribution {
|
|
77
|
+
title?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
author?: string;
|
|
80
|
+
image?: string;
|
|
81
|
+
}
|
|
82
|
+
interface PreviewCard {
|
|
83
|
+
title?: string;
|
|
84
|
+
description?: string;
|
|
85
|
+
image?: string;
|
|
86
|
+
url: string;
|
|
87
|
+
siteName?: string;
|
|
88
|
+
domain?: string;
|
|
89
|
+
author?: string;
|
|
90
|
+
type: MetadataType;
|
|
91
|
+
confidence: number;
|
|
92
|
+
}
|
|
93
|
+
interface RedirectEntry {
|
|
94
|
+
from: string;
|
|
95
|
+
to: string;
|
|
96
|
+
statusCode: number;
|
|
97
|
+
}
|
|
98
|
+
interface ExtractionDiagnostics {
|
|
99
|
+
originalUrl?: string;
|
|
100
|
+
finalUrl?: string;
|
|
101
|
+
canonicalUrl?: string;
|
|
102
|
+
isShortUrl?: boolean;
|
|
103
|
+
shortUrlProvider?: string;
|
|
104
|
+
statusCode?: number;
|
|
105
|
+
contentType?: string;
|
|
106
|
+
redirects: RedirectEntry[];
|
|
107
|
+
sourcesUsed: string[];
|
|
108
|
+
warnings: string[];
|
|
109
|
+
trace: string[];
|
|
110
|
+
adapter?: {
|
|
111
|
+
matched: boolean;
|
|
112
|
+
name?: string;
|
|
113
|
+
confidence?: number;
|
|
114
|
+
};
|
|
115
|
+
errors?: string[];
|
|
116
|
+
selectedImageReason?: string;
|
|
117
|
+
fetchDurationMs?: number;
|
|
118
|
+
extractedAt: string;
|
|
119
|
+
}
|
|
120
|
+
interface UnifiedMetadata {
|
|
121
|
+
ok: boolean;
|
|
122
|
+
url: string;
|
|
123
|
+
finalUrl: string;
|
|
124
|
+
type: MetadataType;
|
|
125
|
+
title?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
siteName?: string;
|
|
128
|
+
canonicalUrl?: string;
|
|
129
|
+
confidence: number;
|
|
130
|
+
completeness: number;
|
|
131
|
+
reliability: number;
|
|
132
|
+
bestImage?: string;
|
|
133
|
+
images: MediaAsset[];
|
|
134
|
+
videos: MediaAsset[];
|
|
135
|
+
audio: MediaAsset[];
|
|
136
|
+
favicons: MediaAsset[];
|
|
137
|
+
article?: ArticleMetadata;
|
|
138
|
+
product?: ProductMetadata;
|
|
139
|
+
video?: VideoMetadata;
|
|
140
|
+
playlist?: PlaylistMetadata;
|
|
141
|
+
author?: Entity;
|
|
142
|
+
publisher?: Entity;
|
|
143
|
+
app?: ApplicationMetadata;
|
|
144
|
+
sources?: MetadataSourceAttribution;
|
|
145
|
+
raw?: RawMetadataSources;
|
|
146
|
+
diagnostics: ExtractionDiagnostics;
|
|
147
|
+
trace: string[];
|
|
148
|
+
}
|
|
149
|
+
interface HtmlMetadata {
|
|
150
|
+
title?: string;
|
|
151
|
+
description?: string;
|
|
152
|
+
keywords?: string[];
|
|
153
|
+
robots?: string;
|
|
154
|
+
canonicalUrl?: string;
|
|
155
|
+
manifestUrl?: string;
|
|
156
|
+
themeColor?: string;
|
|
157
|
+
applicationName?: string;
|
|
158
|
+
favicons: MediaAsset[];
|
|
159
|
+
imageSrc?: MediaAsset;
|
|
160
|
+
alternates: Array<{
|
|
161
|
+
href: string;
|
|
162
|
+
type?: string;
|
|
163
|
+
hreflang?: string;
|
|
164
|
+
title?: string;
|
|
165
|
+
}>;
|
|
166
|
+
}
|
|
167
|
+
interface OpenGraphMetadata {
|
|
168
|
+
title?: string;
|
|
169
|
+
description?: string;
|
|
170
|
+
type?: string;
|
|
171
|
+
url?: string;
|
|
172
|
+
siteName?: string;
|
|
173
|
+
locale?: string;
|
|
174
|
+
determiner?: string;
|
|
175
|
+
images: MediaAsset[];
|
|
176
|
+
videos: MediaAsset[];
|
|
177
|
+
audio: MediaAsset[];
|
|
178
|
+
article?: ArticleMetadata;
|
|
179
|
+
product?: ProductMetadata;
|
|
180
|
+
raw: Record<string, string | string[]>;
|
|
181
|
+
}
|
|
182
|
+
interface TwitterMetadata {
|
|
183
|
+
card?: string;
|
|
184
|
+
site?: string;
|
|
185
|
+
creator?: string;
|
|
186
|
+
title?: string;
|
|
187
|
+
description?: string;
|
|
188
|
+
images: MediaAsset[];
|
|
189
|
+
videos: MediaAsset[];
|
|
190
|
+
raw: Record<string, string | string[]>;
|
|
191
|
+
}
|
|
192
|
+
type JsonLdNode = Record<string, unknown>;
|
|
193
|
+
interface JsonLdMetadata {
|
|
194
|
+
nodes: JsonLdNode[];
|
|
195
|
+
warnings: string[];
|
|
196
|
+
}
|
|
197
|
+
interface OEmbedLink {
|
|
198
|
+
href: string;
|
|
199
|
+
type?: string;
|
|
200
|
+
title?: string;
|
|
201
|
+
}
|
|
202
|
+
interface OEmbedData {
|
|
203
|
+
type?: string;
|
|
204
|
+
version?: string;
|
|
205
|
+
title?: string;
|
|
206
|
+
author_name?: string;
|
|
207
|
+
author_url?: string;
|
|
208
|
+
provider_name?: string;
|
|
209
|
+
provider_url?: string;
|
|
210
|
+
thumbnail_url?: string;
|
|
211
|
+
thumbnail_width?: number;
|
|
212
|
+
thumbnail_height?: number;
|
|
213
|
+
html?: string;
|
|
214
|
+
url?: string;
|
|
215
|
+
width?: number;
|
|
216
|
+
height?: number;
|
|
217
|
+
[key: string]: unknown;
|
|
218
|
+
}
|
|
219
|
+
interface OEmbedMetadata {
|
|
220
|
+
links: OEmbedLink[];
|
|
221
|
+
data: OEmbedData[];
|
|
222
|
+
}
|
|
223
|
+
interface EmbeddedDataItem {
|
|
224
|
+
source: "nextData" | "nuxt" | "initialState" | "preloadedState" | "apollo" | "jsonScript" | "applicationJson" | "youtubeInitialData" | "youtubePlayerResponse";
|
|
225
|
+
path?: string;
|
|
226
|
+
data: JsonLdNode;
|
|
227
|
+
}
|
|
228
|
+
interface EmbeddedDataMetadata {
|
|
229
|
+
items: EmbeddedDataItem[];
|
|
230
|
+
warnings: string[];
|
|
231
|
+
}
|
|
232
|
+
interface AdapterExtractionResult {
|
|
233
|
+
source: string;
|
|
234
|
+
type?: MetadataType;
|
|
235
|
+
title?: string;
|
|
236
|
+
description?: string;
|
|
237
|
+
siteName?: string;
|
|
238
|
+
canonicalUrl?: string;
|
|
239
|
+
images?: MediaAsset[];
|
|
240
|
+
videos?: MediaAsset[];
|
|
241
|
+
audio?: MediaAsset[];
|
|
242
|
+
article?: Partial<ArticleMetadata>;
|
|
243
|
+
product?: Partial<ProductMetadata>;
|
|
244
|
+
video?: Partial<VideoMetadata>;
|
|
245
|
+
playlist?: Partial<PlaylistMetadata>;
|
|
246
|
+
app?: Partial<ApplicationMetadata>;
|
|
247
|
+
author?: Entity;
|
|
248
|
+
publisher?: Entity;
|
|
249
|
+
raw?: Record<string, unknown>;
|
|
250
|
+
warnings?: string[];
|
|
251
|
+
}
|
|
252
|
+
type PluginExtractionResult = AdapterExtractionResult;
|
|
253
|
+
interface RawMetadataSources {
|
|
254
|
+
html: HtmlMetadata;
|
|
255
|
+
openGraph: OpenGraphMetadata;
|
|
256
|
+
twitter: TwitterMetadata;
|
|
257
|
+
jsonLd: JsonLdMetadata;
|
|
258
|
+
embeddedData: EmbeddedDataMetadata;
|
|
259
|
+
oEmbed: OEmbedMetadata;
|
|
260
|
+
images: MediaAsset[];
|
|
261
|
+
videos: MediaAsset[];
|
|
262
|
+
audio: MediaAsset[];
|
|
263
|
+
adapters: AdapterExtractionResult[];
|
|
264
|
+
plugins: PluginExtractionResult[];
|
|
265
|
+
}
|
|
266
|
+
interface ExtractorContext {
|
|
267
|
+
html: string;
|
|
268
|
+
url: string;
|
|
269
|
+
finalUrl: string;
|
|
270
|
+
$: CheerioAPI;
|
|
271
|
+
raw: RawMetadataSources;
|
|
272
|
+
options: ParseMetadataOptions;
|
|
273
|
+
}
|
|
274
|
+
type AdapterContext = ExtractorContext;
|
|
275
|
+
type AdapterRawData = AdapterExtractionResult | Record<string, unknown>;
|
|
276
|
+
interface SiteAdapter<TRawData extends AdapterRawData = AdapterExtractionResult> {
|
|
277
|
+
name: string;
|
|
278
|
+
detect?: (url: URL) => boolean;
|
|
279
|
+
canHandle?: (url: URL) => boolean;
|
|
280
|
+
extract(context: AdapterContext): TRawData | Promise<TRawData>;
|
|
281
|
+
normalize?: (rawData: TRawData, context: AdapterContext) => AdapterExtractionResult | Promise<AdapterExtractionResult>;
|
|
282
|
+
}
|
|
283
|
+
interface CustomExtractor {
|
|
284
|
+
name: string;
|
|
285
|
+
extract(context: ExtractorContext): PluginExtractionResult | Promise<PluginExtractionResult>;
|
|
286
|
+
}
|
|
287
|
+
type ImageScorer = (image: MediaAsset, context: ImageScoringContext) => number;
|
|
288
|
+
interface ImageScoringContext {
|
|
289
|
+
index: number;
|
|
290
|
+
images: MediaAsset[];
|
|
291
|
+
}
|
|
292
|
+
interface MetaNovaPluginApi {
|
|
293
|
+
addAdapter(adapter: SiteAdapter): void;
|
|
294
|
+
addExtractor(name: string, extractor: CustomExtractor["extract"]): void;
|
|
295
|
+
addImageScorer(scorer: ImageScorer): void;
|
|
296
|
+
}
|
|
297
|
+
interface MetaNovaPlugin {
|
|
298
|
+
name: string;
|
|
299
|
+
setup(api: MetaNovaPluginApi): void;
|
|
300
|
+
}
|
|
301
|
+
interface MetaNovaCacheEntry {
|
|
302
|
+
html: string;
|
|
303
|
+
finalUrl?: string;
|
|
304
|
+
statusCode?: number;
|
|
305
|
+
contentType?: string;
|
|
306
|
+
redirects?: RedirectEntry[];
|
|
307
|
+
}
|
|
308
|
+
interface MetaNovaCache {
|
|
309
|
+
get(url: string): MetaNovaCacheEntry | undefined | Promise<MetaNovaCacheEntry | undefined>;
|
|
310
|
+
set(url: string, entry: MetaNovaCacheEntry): void | Promise<void>;
|
|
311
|
+
}
|
|
312
|
+
interface ParseMetadataOptions {
|
|
313
|
+
includeRaw?: boolean;
|
|
314
|
+
plugins?: MetaNovaPlugin[];
|
|
315
|
+
adapters?: SiteAdapter[];
|
|
316
|
+
imageScorers?: ImageScorer[];
|
|
317
|
+
}
|
|
318
|
+
interface FetchMetadataOptions extends ParseMetadataOptions {
|
|
319
|
+
timeoutMs?: number;
|
|
320
|
+
retries?: number;
|
|
321
|
+
retryDelayMs?: number;
|
|
322
|
+
maxRedirects?: number;
|
|
323
|
+
maxBytes?: number;
|
|
324
|
+
userAgent?: string;
|
|
325
|
+
accept?: string;
|
|
326
|
+
acceptLanguage?: string;
|
|
327
|
+
acceptEncoding?: string;
|
|
328
|
+
headers?: HeadersInit;
|
|
329
|
+
signal?: AbortSignal;
|
|
330
|
+
fetch?: typeof fetch;
|
|
331
|
+
cache?: MetaNovaCache;
|
|
332
|
+
allowedProtocols?: string[];
|
|
333
|
+
allowLocalhost?: boolean;
|
|
334
|
+
allowPrivateNetwork?: boolean;
|
|
335
|
+
fetchOEmbed?: boolean;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
declare function createPreviewCard(metadata: UnifiedMetadata): PreviewCard;
|
|
339
|
+
|
|
340
|
+
interface MetaNovaRuntime {
|
|
341
|
+
use(plugin: MetaNovaPlugin): MetaNovaRuntime;
|
|
342
|
+
fetchMetadata(url: string, options?: FetchMetadataOptions): Promise<UnifiedMetadata>;
|
|
343
|
+
parseMetadata(html: string, url: string, options?: ParseMetadataOptions): UnifiedMetadata;
|
|
344
|
+
parseMetadataAsync(html: string, url: string, options?: ParseMetadataOptions): Promise<UnifiedMetadata>;
|
|
345
|
+
createPreviewCard: typeof createPreviewCard;
|
|
346
|
+
}
|
|
347
|
+
declare const MetaNova: MetaNovaRuntime;
|
|
348
|
+
|
|
349
|
+
declare function fetchMetadata(url: string, options?: FetchMetadataOptions): Promise<UnifiedMetadata>;
|
|
350
|
+
|
|
351
|
+
declare function parseMetadata(html: string, url: string, options?: ParseMetadataOptions): UnifiedMetadata;
|
|
352
|
+
declare function parseMetadataAsync(html: string, url: string, options?: ParseMetadataOptions): Promise<UnifiedMetadata>;
|
|
353
|
+
|
|
354
|
+
interface ValidateUrlOptions {
|
|
355
|
+
allowedProtocols?: string[];
|
|
356
|
+
}
|
|
357
|
+
interface ShortUrlInfo {
|
|
358
|
+
isShortUrl: boolean;
|
|
359
|
+
provider?: string;
|
|
360
|
+
}
|
|
361
|
+
declare function validateUrl(input: string, options?: ValidateUrlOptions): URL;
|
|
362
|
+
declare function resolveUrl(url: string, baseUrl?: string): string;
|
|
363
|
+
declare function normalizeUrl(input: string, options?: ValidateUrlOptions): string;
|
|
364
|
+
declare function detectShortUrl(input: string | URL): ShortUrlInfo;
|
|
365
|
+
declare function resolveCanonicalUrl(canonicalUrl: string | undefined, baseUrl: string): string | undefined;
|
|
366
|
+
|
|
367
|
+
interface NormalizeContext {
|
|
368
|
+
url?: string;
|
|
369
|
+
finalUrl?: string;
|
|
370
|
+
diagnostics?: ExtractionDiagnostics;
|
|
371
|
+
imageScorers?: ImageScorer[];
|
|
372
|
+
includeRaw?: boolean;
|
|
373
|
+
}
|
|
374
|
+
declare function normalizeMetadata(rawSources: RawMetadataSources, context?: NormalizeContext): UnifiedMetadata;
|
|
375
|
+
|
|
376
|
+
declare function scoreImages(images: MediaAsset[], customScorers?: ImageScorer[]): MediaAsset[];
|
|
377
|
+
|
|
378
|
+
interface ConfidenceEngineInput {
|
|
379
|
+
title?: string;
|
|
380
|
+
description?: string;
|
|
381
|
+
bestImage?: MediaAsset;
|
|
382
|
+
canonicalUrl?: string;
|
|
383
|
+
author?: Entity;
|
|
384
|
+
hasStructuredData: boolean;
|
|
385
|
+
rawSources: RawMetadataSources;
|
|
386
|
+
sourcesUsed: string[];
|
|
387
|
+
warnings: string[];
|
|
388
|
+
}
|
|
389
|
+
interface CompletenessInput {
|
|
390
|
+
title?: string;
|
|
391
|
+
description?: string;
|
|
392
|
+
bestImage?: MediaAsset;
|
|
393
|
+
canonicalUrl?: string;
|
|
394
|
+
siteName?: string;
|
|
395
|
+
author?: Entity;
|
|
396
|
+
publisher?: Entity;
|
|
397
|
+
type?: string;
|
|
398
|
+
publishedTime?: string;
|
|
399
|
+
mediaCount: number;
|
|
400
|
+
}
|
|
401
|
+
interface ReliabilityInput {
|
|
402
|
+
confidence: number;
|
|
403
|
+
completeness: number;
|
|
404
|
+
adapterMatched: boolean;
|
|
405
|
+
bestImage?: MediaAsset;
|
|
406
|
+
warnings: string[];
|
|
407
|
+
}
|
|
408
|
+
declare function calculateConfidence(input: ConfidenceEngineInput): number;
|
|
409
|
+
declare function calculateCompleteness(input: CompletenessInput): number;
|
|
410
|
+
declare function calculateReliability(input: ReliabilityInput): number;
|
|
411
|
+
|
|
412
|
+
interface MediaDiscoveryResult {
|
|
413
|
+
images: MediaAsset[];
|
|
414
|
+
videos: MediaAsset[];
|
|
415
|
+
audio: MediaAsset[];
|
|
416
|
+
trace: string[];
|
|
417
|
+
}
|
|
418
|
+
declare function discoverMedia(rawSources: RawMetadataSources, finalUrl: string): MediaDiscoveryResult;
|
|
419
|
+
|
|
420
|
+
declare function extractHtmlMetadata(html: string): HtmlMetadata;
|
|
421
|
+
|
|
422
|
+
declare function extractEmbeddedData(html: string): EmbeddedDataMetadata;
|
|
423
|
+
|
|
424
|
+
declare function extractJsonLd(html: string): JsonLdMetadata;
|
|
425
|
+
|
|
426
|
+
declare function extractImages(html: string, baseUrl: string): MediaAsset[];
|
|
427
|
+
declare function extractVideos(html: string, baseUrl: string): MediaAsset[];
|
|
428
|
+
declare function extractAudio(html: string, baseUrl: string): MediaAsset[];
|
|
429
|
+
|
|
430
|
+
declare function extractOEmbed(html: string, url: string): OEmbedMetadata;
|
|
431
|
+
|
|
432
|
+
declare function extractOpenGraph(html: string): OpenGraphMetadata;
|
|
433
|
+
|
|
434
|
+
declare function extractTwitterCards(html: string): TwitterMetadata;
|
|
435
|
+
|
|
436
|
+
type PlatformRawData = AdapterExtractionResult & {
|
|
437
|
+
platform?: string;
|
|
438
|
+
identifiers?: Record<string, string | undefined>;
|
|
439
|
+
};
|
|
440
|
+
declare const youtubeAdapter: SiteAdapter<PlatformRawData>;
|
|
441
|
+
declare const redditAdapter: SiteAdapter<PlatformRawData>;
|
|
442
|
+
declare const pinterestAdapter: SiteAdapter<PlatformRawData>;
|
|
443
|
+
declare const behanceAdapter: SiteAdapter<PlatformRawData>;
|
|
444
|
+
declare const tiktokAdapter: SiteAdapter<PlatformRawData>;
|
|
445
|
+
declare const facebookAdapter: SiteAdapter<PlatformRawData>;
|
|
446
|
+
declare const twitterAdapter: SiteAdapter<PlatformRawData>;
|
|
447
|
+
declare const instagramAdapter: SiteAdapter<PlatformRawData>;
|
|
448
|
+
declare const defaultAdapters: SiteAdapter[];
|
|
449
|
+
|
|
450
|
+
declare function createDiagnostics(): ExtractionDiagnostics;
|
|
451
|
+
declare function addWarning(diagnostics: ExtractionDiagnostics, warning: string): ExtractionDiagnostics;
|
|
452
|
+
|
|
453
|
+
declare const DEFAULT_BROWSER_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36";
|
|
454
|
+
declare const DEFAULT_ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
|
|
455
|
+
declare const DEFAULT_ACCEPT_LANGUAGE = "en-US,en;q=0.9";
|
|
456
|
+
declare const DEFAULT_ACCEPT_ENCODING = "gzip, deflate, br";
|
|
457
|
+
interface FetchedPage {
|
|
458
|
+
url: string;
|
|
459
|
+
originalUrl: string;
|
|
460
|
+
finalUrl: string;
|
|
461
|
+
isShortUrl: boolean;
|
|
462
|
+
shortUrlProvider?: string;
|
|
463
|
+
html: string;
|
|
464
|
+
bytes?: Uint8Array;
|
|
465
|
+
statusCode: number;
|
|
466
|
+
contentType?: string;
|
|
467
|
+
redirects: RedirectEntry[];
|
|
468
|
+
headers: Record<string, string>;
|
|
469
|
+
}
|
|
470
|
+
declare function fetchPage(inputUrl: string, options?: FetchMetadataOptions): Promise<FetchedPage>;
|
|
471
|
+
interface RedirectResolution {
|
|
472
|
+
originalUrl: string;
|
|
473
|
+
finalUrl: string;
|
|
474
|
+
redirects: RedirectEntry[];
|
|
475
|
+
isShortUrl: boolean;
|
|
476
|
+
shortUrlProvider?: string;
|
|
477
|
+
}
|
|
478
|
+
declare function resolveRedirects(inputUrl: string, options?: FetchMetadataOptions): Promise<RedirectResolution>;
|
|
479
|
+
|
|
480
|
+
declare class SecurityError extends Error {
|
|
481
|
+
constructor(message: string);
|
|
482
|
+
}
|
|
483
|
+
declare function assertSafeRequestUrl(input: string, options?: FetchMetadataOptions): Promise<string>;
|
|
484
|
+
|
|
485
|
+
interface MetaNovaRegistry {
|
|
486
|
+
adapters: SiteAdapter[];
|
|
487
|
+
extractors: CustomExtractor[];
|
|
488
|
+
imageScorers: ImageScorer[];
|
|
489
|
+
}
|
|
490
|
+
declare function registerGlobalPlugin(plugin: MetaNovaPlugin): void;
|
|
491
|
+
declare function createRegistry(options?: ParseMetadataOptions): MetaNovaRegistry;
|
|
492
|
+
|
|
493
|
+
export { type AdapterContext, type AdapterExtractionResult, type AdapterRawData, type ApplicationMetadata, type ArticleMetadata, type CompletenessInput, type ConfidenceEngineInput, type CustomExtractor, DEFAULT_ACCEPT, DEFAULT_ACCEPT_ENCODING, DEFAULT_ACCEPT_LANGUAGE, DEFAULT_BROWSER_USER_AGENT, type EmbeddedDataItem, type EmbeddedDataMetadata, type Entity, type ExtractionDiagnostics, type ExtractorContext, type FetchMetadataOptions, type FetchedPage, type HtmlMetadata, type ImageScorer, type ImageScoringContext, type JsonLdMetadata, type JsonLdNode, type MediaAsset, type MediaDiscoveryResult, type MediaKind, MetaNova, type MetaNovaCache, type MetaNovaCacheEntry, type MetaNovaPlugin, type MetaNovaPluginApi, type MetaNovaRegistry, type MetadataSource, type MetadataSourceAttribution, type MetadataType, type OEmbedData, type OEmbedLink, type OEmbedMetadata, type OpenGraphMetadata, type ParseMetadataOptions, type PlaylistMetadata, type PlaylistVideo, type PluginExtractionResult, type PreviewCard, type ProductMetadata, type RawMetadataSources, type RedirectEntry, type RedirectResolution, type ReliabilityInput, SecurityError, type SiteAdapter, type TwitterMetadata, type UnifiedMetadata, type VideoMetadata, addWarning, assertSafeRequestUrl, behanceAdapter, calculateCompleteness, calculateConfidence, calculateReliability, createDiagnostics, createPreviewCard, createRegistry, MetaNova as default, defaultAdapters, detectShortUrl, discoverMedia, extractAudio, extractEmbeddedData, extractHtmlMetadata, extractImages, extractJsonLd, extractOEmbed, extractOpenGraph, extractTwitterCards, extractVideos, facebookAdapter, fetchMetadata, fetchPage, instagramAdapter, normalizeMetadata, normalizeUrl, parseMetadata, parseMetadataAsync, pinterestAdapter, redditAdapter, registerGlobalPlugin, resolveCanonicalUrl, resolveRedirects, resolveUrl, scoreImages, tiktokAdapter, twitterAdapter, validateUrl, youtubeAdapter };
|