From 5af5e422ec4d15de2f3fee57245c9f4bb8c1f751 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Sat, 6 Sep 2025 20:02:23 +0000 Subject: [PATCH] Improve video categorization and ad loading logic Update filtering for specific video categories like "FOLX STADL" and "GIPFELSTAMMTISCH" to include more variations and improve AdSense ad loading by checking container dimensions before initialization. Also, disable auto-refresh on error. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 636b67ca-6f18-4eb7-b992-168c6c8b7078 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/60d372ff-2c10-46c7-b01b-10c3435136b0/636b67ca-6f18-4eb7-b992-168c6c8b7078/DuqMKeH --- client/src/components/adsense-ad.tsx | 23 +++++++++++---- client/src/components/netflix-grid.tsx | 39 +++++++++++++++++--------- client/src/main.tsx | 6 ++-- 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/client/src/components/adsense-ad.tsx b/client/src/components/adsense-ad.tsx index 961ba7e..6abd647 100644 --- a/client/src/components/adsense-ad.tsx +++ b/client/src/components/adsense-ad.tsx @@ -19,13 +19,26 @@ export default function AdSenseAd({ useEffect(() => { try { - // Ensure adsbygoogle is loaded - if (typeof window !== 'undefined') { - // @ts-ignore - (window.adsbygoogle = window.adsbygoogle || []).push({}); + // Only initialize if the ad container has proper dimensions + if (typeof window !== 'undefined' && adRef.current) { + const adContainer = adRef.current; + const rect = adContainer.getBoundingClientRect(); + + // Wait for proper dimensions before initializing + if (rect.width > 0 && rect.height > 0) { + // Small delay to ensure DOM is fully ready + setTimeout(() => { + try { + // @ts-ignore + (window.adsbygoogle = window.adsbygoogle || []).push({}); + } catch (error) { + console.warn('AdSense initialization skipped:', error); + } + }, 100); + } } } catch (error) { - console.error('AdSense initialization error:', error); + console.warn('AdSense initialization error:', error); } }, []); diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index 1295e59..917f9c2 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -49,10 +49,15 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) { new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() ); - // FOLX STADL videos - const folxStadlVideos = videos.filter(video => - video.title.includes("FOLX STADL") || video.title.includes("FOLXSTADL") - ); + // FOLX STADL videos - updated patterns to catch more variations + const folxStadlVideos = videos.filter(video => { + const title = video.title.toLowerCase(); + return title.includes("folx stadl") || + title.includes("folxstadl") || + title.includes("folx-stadl") || + title.includes("volx stadl") || + title.includes("folx_stadl"); + }); return [ { @@ -100,10 +105,13 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) { { title: "GIPFELSTAMMTISCH", videos: (() => { - // Filter videos that specifically contain "Gipfelstammtisch" in title - const gipfelVideos = videos.filter(video => - video.title.includes("Gipfelstammtisch") - ); + // Filter videos that contain "Gipfelstammtisch" in various forms + const gipfelVideos = videos.filter(video => { + const title = video.title.toLowerCase(); + return title.includes("gipfelstammtisch") || + title.includes("gipfel stammtisch") || + title.includes("gipfel-stammtisch"); + }); // Shuffle the Gipfelstammtisch videos randomly const shuffled = [...gipfelVideos].sort(() => Math.random() - 0.5); @@ -115,11 +123,16 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) { { title: "DIE Geschichte des Liedes", videos: (() => { - // Filter videos that specifically contain "Geschichte des Liedes" in title or description - const gdlVideos = videos.filter(video => - video.title.toLowerCase().includes("geschichte des liedes") || - video.description?.toLowerCase().includes("geschichte des liedes") - ); + // Filter videos that contain "Geschichte des Liedes" in various forms + const gdlVideos = videos.filter(video => { + const title = video.title.toLowerCase(); + const desc = video.description?.toLowerCase() || ""; + return title.includes("geschichte des liedes") || + title.includes("gschichte des liedes") || + title.includes("die geschichte des liedes") || + desc.includes("geschichte des liedes") || + desc.includes("gschichte des liedes"); + }); // If no specific "Geschichte des Liedes" videos found, fallback to general filter if (gdlVideos.length === 0) { diff --git a/client/src/main.tsx b/client/src/main.tsx index d5e5d0f..b1ee6d7 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -80,10 +80,8 @@ function initApp() { `; - // Auto-refresh on error - setTimeout(() => { - location.reload(); - }, 3000); + // Remove auto-refresh to prevent loops + console.warn('Auto-refresh disabled to prevent reload loops'); } } }