Últimas Notícias
// Função para buscar notícias via RSS (usando um proxy CORS)
async function carregarNoticias() {
try {
const response = await fetch('https://api.rss2json.com/v1/api.json?rss_url=https://ge.globo.com/rss/ge/futebol/');
const data = await response.json();
const listaNoticias = document.getElementById('lista-noticias');
listaNoticias.innerHTML = '';
data.items.slice(0, 5).forEach(item => {
const noticia = document.createElement('div');
noticia.innerHTML = `
${item.title}
${item.description.substring(0, 150)}...
${new Date(item.pubDate).toLocaleDateString('pt-BR')}
`;
listaNoticias.appendChild(noticia);
});
} catch (error) {
document.getElementById('lista-noticias').innerHTML = 'Erro ao carregar notícias.';
}
}
// Carregar notícias ao carregar a página
carregarNoticias();
// Atualizar a cada 30 minutos
setInterval(carregarNoticias, 30 * 60 * 1000);