const res = await fetch(
'https://v3.football.api-sports.io/standings?league=39&season=2024',
{ headers: { 'x-apisports-key': process.env.API_FOOTBALL_KEY } }
);
const { response: [{ league }] } = await res.json();
const top5 = league.standings[0].slice(0, 5);
top5.forEach(t => console.log(`${t.rank}. ${t.team.name} — ${t.points} pts`));const res = await fetch(
'https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard'
);
const { events } = await res.json();
events?.slice(0, 3).forEach(e => {
const [home, away] = e.competitions[0].competitors;
console.log(`${away.team.abbreviation} ${away.score} @ ${home.team.abbreviation} ${home.score} — ${e.status.type.description}`);
});const res = await fetch(
'https://api.football-data.org/v4/competitions/PL/scorers?limit=5',
{ headers: { 'X-Auth-Token': process.env.FOOTBALL_DATA_KEY } }
);
const { scorers } = await res.json();
scorers.forEach((s, i) =>
console.log(`${i + 1}. ${s.player.name} (${s.team.name}): ${s.goals} goals`)
);const res = await fetch(
'https://stats.nba.com/stats/leagueLeaders?LeagueID=00&PerMode=PerGame&Scope=S&Season=2024-25&SeasonType=Regular+Season&StatCategory=PTS',
{
headers: {
Referer: 'https://www.nba.com/',
'User-Agent': 'Mozilla/5.0',
},
}
);
const { resultSet } = (await res.json()).resultSets[0];
// resultSet contains [rank, player_id, player, team, ...stats]const res = await fetch(
'https://api.openligadb.de/getmatchdata/bl1/2024/1'
);
const matches = await res.json();
matches.slice(0, 5).forEach(m =>
console.log(`${m.team1.teamName} ${m.matchResults?.[0]?.pointsTeam1 ?? '-'} : ${m.matchResults?.[0]?.pointsTeam2 ?? '-'} ${m.team2.teamName}`)
);const res = await fetch(
`https://www.thesportsdb.com/api/v1/json/${process.env.TSDB_API_KEY}/eventsseason.php?id=4328&s=2023-2024`
);
const { events } = await res.json();
console.log(`Premier League 2023-24 events: ${events?.length}`);
events?.slice(0, 3).forEach(e => console.log(`${e.dateEvent}: ${e.strHomeTeam} vs ${e.strAwayTeam}`));