embedDetection Utility
File: src/utils/embedDetection.ts
Overview
Exports
- normalizeEmbedUrl - function export
- parseEmbedUrl - function export
- detectEmbedProviderFromUrl - function export
- isHarmonyPostUrl - function export
- isHarmonyInviteUrl - function export
- getHarmonyInviteCode - function export
- getHarmonyPostId - function export
- isYouTubeUrl - function export
- isSpotifyUrl - function export
- extractYouTubeId - function export
- buildYouTubeEmbedUrl - function export
- buildSpotifyEmbedUrl - function export
Functions
normalizeEmbedUrl(raw: string)
No description available.
Parameters:
raw: string
Returns: string | null
export function normalizeEmbedUrl(raw: string): string | nullparseEmbedUrl(raw: string)
No description available.
Parameters:
raw: string
Returns: URL | null
export function parseEmbedUrl(raw: string): URL | nulldetectEmbedProviderFromUrl(input: string | URL)
No description available.
Parameters:
input: string | URL
Returns: EmbedProvider
export function detectEmbedProviderFromUrl(input: string | URL): EmbedProviderisHarmonyPostUrl(url: URL)
No description available.
Parameters:
url: URL
Returns: boolean
export function isHarmonyPostUrl(url: URL): booleanisHarmonyInviteUrl(url: URL)
No description available.
Parameters:
url: URL
Returns: boolean
export function isHarmonyInviteUrl(url: URL): booleangetHarmonyInviteCode(url: URL)
No description available.
Parameters:
url: URL
Returns: string | null
export function getHarmonyInviteCode(url: URL): string | nullgetHarmonyPostId(url: URL)
No description available.
Parameters:
url: URL
Returns: string | null
export function getHarmonyPostId(url: URL): string | nullisYouTubeUrl(url: URL)
No description available.
Parameters:
url: URL
Returns: boolean
export function isYouTubeUrl(url: URL): booleanisSpotifyUrl(url: URL)
No description available.
Parameters:
url: URL
Returns: boolean
export function isSpotifyUrl(url: URL): booleanextractYouTubeId(url: URL)
No description available.
Parameters:
url: URL
Returns: string | null
export function extractYouTubeId(url: URL): string | nullparseYouTubeTime(url: URL)
No description available.
Parameters:
url: URL
Returns: number | null
/**
* Parse YouTube time parameter to seconds.
* Handles: ?t=90, ?t=1m30s, ?t=1h2m30s, &t=90, youtu.be/id?t=90
*/
function parseYouTubeTime(url: URL): number | null2
3
4
5
buildYouTubeEmbedUrl(url: URL)
No description available.
Parameters:
url: URL
Returns: string | null
export function buildYouTubeEmbedUrl(url: URL): string | nullbuildSpotifyEmbedUrl(url: URL)
No description available.
Parameters:
url: URL
Returns: string | null
export function buildSpotifyEmbedUrl(url: URL): string | nullSource Code Insights
File Size: 4897 characters Lines of Code: 167 Imports: 1
Usage Example
import { normalizeEmbedUrl, parseEmbedUrl, detectEmbedProviderFromUrl, isHarmonyPostUrl, isHarmonyInviteUrl, getHarmonyInviteCode, getHarmonyPostId, isYouTubeUrl, isSpotifyUrl, extractYouTubeId, buildYouTubeEmbedUrl, buildSpotifyEmbedUrl } from '@/utils/embedDetection'
// Example usage
normalizeEmbedUrl()2
3
4
This documentation was automatically generated from the source code.
