UNPKG

@social-embed/lib

Version:

URL detection and parsing for embed providers (YouTube, other OEmbed compatible providers),

53 lines 1.93 kB
import { EmbedProvider } from '../provider'; /** * Detection and parsing for Edpuzzle URLs. * * [Edpuzzle's official embed docs](https://support.edpuzzle.com/hc/en-us/articles/360007260632-Can-I-embed-an-assignment-into-an-LMS-blog-or-website-) * * @module providers/edpuzzle */ /** * A regex pattern that matches an Edpuzzle media ID from a URL. * * @remarks * Matches IDs from URLs like: * `https://edpuzzle.com/media/606b413369971e424ec6021e` * `https://www.edpuzzle.com/media/606b413369971e424ec6021e` */ export declare const edPuzzleUrlRegex: RegExp; /** * Returns the EdPuzzle media ID from a given URL string. * * @param url - The shared EdPuzzle URL link (can be `undefined`). * @returns The extracted EdPuzzle ID if found, or an empty string otherwise. * @throws If `url` length exceeds 1000 characters (for security/performance reasons). * * @example * ```ts * const id = getEdPuzzleIdFromUrl("https://edpuzzle.com/media/606b413369971e424ec6021e"); * console.log(id); // "606b413369971e424ec6021e" * ``` */ export declare const getEdPuzzleIdFromUrl: (url: string | undefined) => string; /** * Constructs a standard EdPuzzle embed URL from a given EdPuzzle media ID. * * @param edPuzzleId - The EdPuzzle ID to embed. * @returns An embeddable URL: `https://edpuzzle.com/embed/media/<edPuzzleId>` * * @example * ```ts * console.log(getEdPuzzleEmbedUrlFromId("606b413369971e424ec6021e")); * // "https://edpuzzle.com/embed/media/606b413369971e424ec6021e" * ``` */ export declare const getEdPuzzleEmbedUrlFromId: (id: string) => string; /** * A provider implementation for EdPuzzle, following the {@link EmbedProvider} interface. * * @remarks * It exports `canParseUrl`, `getIdFromUrl`, and `getEmbedUrlFromId` for * EdPuzzle-based media. Useful with `convertUrlToEmbedUrl` or custom logic. */ export declare const EdPuzzleProvider: EmbedProvider; //# sourceMappingURL=edpuzzle.d.ts.map