// Substituído pelos seus dados novos const API_URL = 'https://api.painelwb.com.br/fixtures'; const API_TOKEN = '2327aa4975db80785d0c365cdf11ffdf-asc-edge9'; let currentOffset = 0; let currentCategory = 'all'; // DATABASE DE LIGAS (Mantido o seu original) const LIGAS = { 71: { name: "Brasileirão A", channels: ["Globo", "Premiere"], cat: 'br', destaque: true }, 72: { name: "Brasileirão B", channels: ["Premiere", "SporTV"], cat: 'br', destaque: false }, 73: { name: "Copa do Brasil", channels: ["Globo", "Amazon", "SporTV"], cat: 'br', destaque: true }, 13: { name: "Libertadores", channels: ["Globo", "Disney+", "Paramount"], cat: 'br', destaque: true }, 2: { name: "Champions League", channels: ["SBT", "TNT", "Max"], cat: 'world', destaque: true }, 39: { name: "Premier League", channels: ["ESPN", "Disney+"], cat: 'world', destaque: true }, // ... adicione outras ligas conforme necessário }; function getChannelHtml(channels) { if (!channels || channels.length === 0) return 'A Confirmar'; return channels.map(ch => { let cls = 'ch-generic'; const name = ch.toLowerCase(); if (name.includes('globo')) cls = 'ch-globo'; else if (name.includes('premiere')) cls = 'ch-premiere'; else if (name.includes('disney')) cls = 'ch-disney'; else if (name.includes('max')) cls = 'ch-max'; else if (name.includes('espn')) cls = 'ch-espn'; else if (name.includes('cazé')) cls = 'ch-cazetv'; return `${ch}`; }).join(''); } function shareMatch(home, away, scoreHome, scoreAway, status, league, channels) { const text = encodeURIComponent(`⚽ *GIRO DE GOLS*\n\n🏆 ${league}\n⚔️ ${home} ${scoreHome} x ${scoreAway} ${away}\n⏰ ${status}\n📺 ${channels.join(', ')}`); window.open(`https://api.whatsapp.com/send?text=${text}`); } async function fetchData() { const resultsDiv = document.getElementById('results'); resultsDiv.innerHTML = '
'; const date = new Date(); date.setDate(date.getDate() + currentOffset); const dateStr = date.toISOString().split('T')[0]; try { // AJUSTE NA CHAMADA: Usando o novo cabeçalho de autorização const res = await fetch(`${API_URL}?date=${dateStr}`, { headers: { 'Authorization': `Bearer ${API_TOKEN}`, 'Content-Type': 'application/json' } }); const data = await res.json(); // Tentativa de mapear a resposta (ajuste conforme a estrutura real da painelwb) let matches = (data.response || data.data || []).filter(item => { const info = LIGAS[item.league.id]; if (!info) return false; return (currentCategory === 'all' || info.cat === currentCategory); }); if (matches.length === 0) { resultsDiv.innerHTML = `