import { EmbedProvider } from '../provider'; /** * Regex matcher for YouTube URLs. * * @remarks * This pattern captures the 11-character YouTube video ID from multiple formats: * - `https://www.youtube.com/watch?v=...` * - `https://www.youtube.com/shorts/...` (YouTube Shorts) * - `https://youtu.be/...` * - Variants with or without `www.` / `-nocookie` * * **Credit**: [Stack Overflow](https://stackoverflow.com/a/42442074) (modified to support Shorts) */ export declare const youTubeUrlRegex: RegExp; /** * Regex to detect YouTube Shorts URLs specifically. */ export declare const youTubeShortsRegex: RegExp; /** * Checks if a URL is a YouTube Shorts URL. * * @param url - The URL to check. * @returns `true` if the URL is a YouTube Shorts URL, `false` otherwise. * * @example * ```ts * isYouTubeShortsUrl("https://www.youtube.com/shorts/eWasNsSa42s"); // true * isYouTubeShortsUrl("https://www.youtube.com/watch?v=abc123"); // false * ``` */ export declare const isYouTubeShortsUrl: (url: string | undefined) => boolean; /** * Default dimensions for YouTube Shorts embeds (9:16 portrait aspect ratio). * * @remarks * YouTube Shorts are vertical videos with a 9:16 aspect ratio. * These dimensions provide a good default for embedding Shorts. */ export declare const YOUTUBE_SHORTS_DIMENSIONS: { readonly height: 616; readonly width: 347; }; /** * Extracts an 11-character YouTube video ID from a given URL string. * * @param url - The string potentially representing a YouTube link (can be `undefined`). * @returns The extracted video ID, or an empty string if no match is found. * * @example * ```ts * // With a watch URL: * getYouTubeIdFromUrl("https://www.youtube.com/watch?v=FTQbiNvZqaY"); // "FTQbiNvZqaY" * * // With a shortlink: * getYouTubeIdFromUrl("https://youtu.be/FTQbiNvZqaY"); // "FTQbiNvZqaY" * * // With a Shorts URL: * getYouTubeIdFromUrl("https://www.youtube.com/shorts/eWasNsSa42s"); // "eWasNsSa42s" * ``` * * @remarks * If `url` is `undefined` or not a valid YouTube link, returns an empty string. */ export declare const getYouTubeIdFromUrl: (url: string | undefined) => string; /** * Constructs a YouTube embed URL from a 11-character video ID. * * @param id - The YouTube video ID. * @returns An embeddable URL in the form `https://www.youtube.com/embed/`. * * @example * ```ts * console.log(getYouTubeEmbedUrlFromId("FTQbiNvZqaY")); * // "https://www.youtube.com/embed/FTQbiNvZqaY" * ``` */ export declare const getYouTubeEmbedUrlFromId: (id: string | undefined) => string; /** * A provider implementation for YouTube, satisfying the {@link EmbedProvider} interface. * * @remarks * - `canParseUrl()` detects if a URL belongs to YouTube using {@link youTubeUrlRegex}. * - `getIdFromUrl()` extracts the YouTube video ID (11 chars). * - `getEmbedUrlFromId()` builds a playable embed URL. */ export declare const YouTubeProvider: EmbedProvider; //# sourceMappingURL=youtube.d.ts.map