/** * Shared utilities for social media scrapers. */ import type { ScrapedMetadata, ScrapeOutcome } from './types'; export declare const DEFAULT_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"; /** * Response interface for Bun type workaround. * Includes `url` to capture the final URL after redirects. */ export interface FullResponse { url: string; ok: boolean; status: number; text(): Promise; } /** * Navigate nested object safely. */ export declare function getNestedValue(obj: unknown, path: string[]): unknown; /** * Extract hashtags from text. * Returns lowercase hashtags without the # prefix. */ export declare function extractHashtags(text: string): string[]; /** * Extract JSON-LD structured data from HTML. */ export declare function extractJsonLd(html: string): unknown[]; /** * Extract Open Graph meta tags from HTML. */ export declare function extractOpenGraph(html: string): Record; /** * Find JSON-LD data matching specific schema types. */ export declare function findJsonLdByType(jsonLd: unknown[], types: string[]): Record | null; /** * Extract image URL from various formats. */ export declare function extractImageUrl(image: unknown): string | null; /** * Wrap a metadata parsing result with standard error handling. */ export declare function wrapParseResult(metadata: ScrapedMetadata | null, url: string): ScrapeOutcome; /** * Create a network error outcome from a caught exception. */ export declare function networkError(error: unknown, url: string): ScrapeOutcome; /** * Create standard HTML fetch headers. */ export declare function createHtmlFetchHeaders(userAgent: string): Record; /** * Handle HTTP errors from fetch responses. * Returns null if response is OK, otherwise returns an error outcome. */ export declare function handleHttpError(response: FullResponse, url: string, platformName: string, notFoundMessage: string): ScrapeOutcome | null; //# sourceMappingURL=utils.d.ts.map