import { Video } from "lucide-react"; import { BookmarkTypes, ZBookmark } from "@karakeep/shared/types/bookmarks"; import { ContentRenderer } from "./types"; function extractTikTokVideoId(url: string): string | null { const patterns = [ /tiktok\.com\/@[^/]+\/video\/(\d+)/, /tiktok\.com\/t\/([A-Za-z0-9]+)/, /vm\.tiktok\.com\/([A-Za-z0-9]+)/, /tiktok\.com\/v\/(\d+)/, ]; for (const pattern of patterns) { const match = url.match(pattern); if (match) { return match[1]; } } return null; } function canRenderTikTok(bookmark: ZBookmark): boolean { if (bookmark.content.type !== BookmarkTypes.LINK) { return false; } const url = bookmark.content.url; return extractTikTokVideoId(url) !== null; } function TikTokRendererComponent({ bookmark }: { bookmark: ZBookmark }) { if (bookmark.content.type !== BookmarkTypes.LINK) { return null; } const videoId = extractTikTokVideoId(bookmark.content.url); if (!videoId) { return null; } // TikTok embed URL format const embedUrl = `https://www.tiktok.com/embed/v2/${videoId}`; return (