fix Analyse

This commit is contained in:
nadja
2026-08-26 18:29:39 +02:00
parent 797279f641
commit e60da3daf6
9 changed files with 18 additions and 127 deletions

View File

@@ -53,18 +53,10 @@ export default function RecipeDetail() {
let videoId = null;
let embedUrl = null;
if (sourceUrl) {
if (sourceType === 'instagram') {
const igMatch = sourceUrl.match(/instagram\.com\/(?:p|reel)\/([A-Za-z0-9_-]+)/);
if (igMatch) {
videoId = igMatch[1];
embedUrl = `https://www.instagram.com/reel/${videoId}/embed/`;
}
} else {
const ttMatch = sourceUrl.match(/video\/(\d+)/);
if (ttMatch) {
videoId = ttMatch[1];
embedUrl = `https://www.tiktok.com/embed/v2/${videoId}`;
}
const ttMatch = sourceUrl.match(/video\/(\d+)/);
if (ttMatch) {
videoId = ttMatch[1];
embedUrl = `https://www.tiktok.com/embed/v2/${videoId}`;
}
}
@@ -78,7 +70,7 @@ export default function RecipeDetail() {
<div className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
{embedUrl && (
<div className="w-full" style={{ paddingBottom: sourceType === 'instagram' ? '100%' : '177.78%', position: 'relative' }}>
<div className="w-full" style={{ paddingBottom: '177.78%', position: 'relative' }}>
<iframe
src={embedUrl}
className="absolute inset-0 w-full h-full"
@@ -153,7 +145,7 @@ export default function RecipeDetail() {
{author && (
<p className="text-xs text-gray-400">
Quelle: @{author} ({sourceType === 'instagram' ? 'Instagram' : 'TikTok'})
Quelle: @{author} (TikTok)
</p>
)}