mirror of https://github.com/itsmrval/somycal
team_dictionnaire + Match api
parent
c7601238ec
commit
a9ba00cdc5
|
|
@ -0,0 +1,70 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Liste d'Équipes</title>
|
||||||
|
<!-- Bootstrap CSS (via CDN) -->
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<h1 class="text-center mb-4">Liste d'Équipes</h1>
|
||||||
|
<input type="text" id="searchInput" class="form-control mb-4" placeholder="Rechercher une équipe..." oninput="filterTeams()">
|
||||||
|
<ul id="teamList" class="list-group"></ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS, Popper.js, and jQuery (via CDN) -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
|
||||||
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Liste d'équipes (exemple)
|
||||||
|
const teams = [
|
||||||
|
"Équipe 1",
|
||||||
|
"Équipe 2",
|
||||||
|
"Équipe 3",
|
||||||
|
"Équipe 4",
|
||||||
|
"Équipe 5",
|
||||||
|
"Équipe 6",
|
||||||
|
"Équipe 7",
|
||||||
|
"Équipe 8",
|
||||||
|
"Équipe 9",
|
||||||
|
"Équipe 10"
|
||||||
|
// Ajoutez plus d'équipes au besoin
|
||||||
|
];
|
||||||
|
|
||||||
|
// Fonction pour afficher les équipes dans la liste
|
||||||
|
function displayTeams(filteredTeams) {
|
||||||
|
const teamList = document.getElementById("teamList");
|
||||||
|
teamList.innerHTML = "";
|
||||||
|
|
||||||
|
for (let i = 0; i < filteredTeams.length; i++) {
|
||||||
|
const teamItem = document.createElement("li");
|
||||||
|
teamItem.className = "list-group-item";
|
||||||
|
teamItem.textContent = filteredTeams[i];
|
||||||
|
teamItem.onclick = function () {
|
||||||
|
alert("Vous avez cliqué sur " + filteredTeams[i]);
|
||||||
|
};
|
||||||
|
|
||||||
|
teamList.appendChild(teamItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Affiche les cinq premières équipes par défaut
|
||||||
|
displayTeams(teams.slice(0, 5));
|
||||||
|
|
||||||
|
// Fonction pour filtrer les équipes en fonction de la recherche
|
||||||
|
function filterTeams() {
|
||||||
|
const searchInput = document.getElementById("searchInput");
|
||||||
|
const searchTerm = searchInput.value.toLowerCase();
|
||||||
|
|
||||||
|
const filteredTeams = teams.filter(team => team.toLowerCase().includes(searchTerm));
|
||||||
|
|
||||||
|
// Affiche les équipes filtrées
|
||||||
|
displayTeams(filteredTeams);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
63
index.py
63
index.py
|
|
@ -0,0 +1,63 @@
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
|
||||||
|
# URL du JSON
|
||||||
|
url = "https://cdn.nba.com/static/json/staticData/scheduleLeagueV2.json"
|
||||||
|
|
||||||
|
# Obtenir le contenu JSON de l'URL
|
||||||
|
response = requests.get(url)
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
# Liste des matchs avec les informations demandées
|
||||||
|
matches_info = []
|
||||||
|
|
||||||
|
for game_date in data['leagueSchedule']['gameDates']:
|
||||||
|
for game in game_date['games']:
|
||||||
|
match_info = {
|
||||||
|
'gameDateTimeUTC': game['gameDateTimeUTC'],
|
||||||
|
'weekNumber': game['weekNumber'],
|
||||||
|
'arenaName': game['arenaName'],
|
||||||
|
'seriesText': game['seriesText'],
|
||||||
|
'hometeamName': game['homeTeam']['teamName'],
|
||||||
|
'awayteamName': game['awayTeam']['teamName'],
|
||||||
|
}
|
||||||
|
matches_info.append(match_info)
|
||||||
|
|
||||||
|
# Afficher la liste des matchs
|
||||||
|
#print(matches_info)
|
||||||
|
|
||||||
|
teams_dict = {
|
||||||
|
1: "Lakers",
|
||||||
|
2: "Heat",
|
||||||
|
3: "Warriors",
|
||||||
|
4: "Celtics",
|
||||||
|
5: "Spurs",
|
||||||
|
6: "Knicks",
|
||||||
|
7: "Pistons",
|
||||||
|
8: "Magic",
|
||||||
|
9: "Suns",
|
||||||
|
10: "Pacers",
|
||||||
|
11: "Jazz",
|
||||||
|
12: "Trail Blazers",
|
||||||
|
13: "Raptors",
|
||||||
|
14: "Mavericks",
|
||||||
|
15: "Bucks",
|
||||||
|
16: "Thunder",
|
||||||
|
17: "Bulls",
|
||||||
|
18: "Pelicans",
|
||||||
|
19: "Rockets",
|
||||||
|
20: "Kings",
|
||||||
|
21: "Clippers",
|
||||||
|
22: "Cavaliers",
|
||||||
|
23: "Hawks",
|
||||||
|
24: "Grizzlies",
|
||||||
|
25: "Nuggets",
|
||||||
|
26: "Hornets",
|
||||||
|
27: "76ers",
|
||||||
|
28: "Wizards",
|
||||||
|
29: "Timberwolves",
|
||||||
|
30: "Nets"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Affichage du dictionnaire
|
||||||
|
print(teams_dict)
|
||||||
Loading…
Reference in New Issue