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
This commit is contained in:
sebastjanartic 2025-09-06 20:02:23 +00:00
parent d4d55730e8
commit 5af5e422ec
3 changed files with 46 additions and 22 deletions

View File

@ -19,13 +19,26 @@ export default function AdSenseAd({
useEffect(() => { useEffect(() => {
try { try {
// Ensure adsbygoogle is loaded // Only initialize if the ad container has proper dimensions
if (typeof window !== 'undefined') { if (typeof window !== 'undefined' && adRef.current) {
// @ts-ignore const adContainer = adRef.current;
(window.adsbygoogle = window.adsbygoogle || []).push({}); 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) { } catch (error) {
console.error('AdSense initialization error:', error); console.warn('AdSense initialization error:', error);
} }
}, []); }, []);

View File

@ -49,10 +49,15 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) {
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
); );
// FOLX STADL videos // FOLX STADL videos - updated patterns to catch more variations
const folxStadlVideos = videos.filter(video => const folxStadlVideos = videos.filter(video => {
video.title.includes("FOLX STADL") || video.title.includes("FOLXSTADL") 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 [ return [
{ {
@ -100,10 +105,13 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) {
{ {
title: "GIPFELSTAMMTISCH", title: "GIPFELSTAMMTISCH",
videos: (() => { videos: (() => {
// Filter videos that specifically contain "Gipfelstammtisch" in title // Filter videos that contain "Gipfelstammtisch" in various forms
const gipfelVideos = videos.filter(video => const gipfelVideos = videos.filter(video => {
video.title.includes("Gipfelstammtisch") const title = video.title.toLowerCase();
); return title.includes("gipfelstammtisch") ||
title.includes("gipfel stammtisch") ||
title.includes("gipfel-stammtisch");
});
// Shuffle the Gipfelstammtisch videos randomly // Shuffle the Gipfelstammtisch videos randomly
const shuffled = [...gipfelVideos].sort(() => Math.random() - 0.5); const shuffled = [...gipfelVideos].sort(() => Math.random() - 0.5);
@ -115,11 +123,16 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) {
{ {
title: "DIE Geschichte des Liedes", title: "DIE Geschichte des Liedes",
videos: (() => { videos: (() => {
// Filter videos that specifically contain "Geschichte des Liedes" in title or description // Filter videos that contain "Geschichte des Liedes" in various forms
const gdlVideos = videos.filter(video => const gdlVideos = videos.filter(video => {
video.title.toLowerCase().includes("geschichte des liedes") || const title = video.title.toLowerCase();
video.description?.toLowerCase().includes("geschichte des liedes") 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 no specific "Geschichte des Liedes" videos found, fallback to general filter
if (gdlVideos.length === 0) { if (gdlVideos.length === 0) {

View File

@ -80,10 +80,8 @@ function initApp() {
</div> </div>
`; `;
// Auto-refresh on error // Remove auto-refresh to prevent loops
setTimeout(() => { console.warn('Auto-refresh disabled to prevent reload loops');
location.reload();
}, 3000);
} }
} }
} }