diff --git a/Existing_API_Collection/Cricket_Score_API/README.md b/Existing_API_Collection/Cricket_Score_API/README.md new file mode 100644 index 0000000..608ed06 --- /dev/null +++ b/Existing_API_Collection/Cricket_Score_API/README.md @@ -0,0 +1,26 @@ +# Cricket Score Dashboard + +This is a simple web application that displays current cricket matches, live scores, and a list of players using data fetched from cricket APIs. + +## Features + +- Displays current cricket matches with details like venue and date. +- Shows live scores of ongoing cricket matches. +- Provides a list of cricket players. + +## Technologies Used + +- HTML +- CSS (Bootstrap) +- JavaScript + +## How to Use + +1. Clone this repository to your local machine. + + ```bash + git clone + +2. go to folder Cricket_Score_API + +3. Run index.html file \ No newline at end of file diff --git a/Existing_API_Collection/Cricket_Score_API/index.html b/Existing_API_Collection/Cricket_Score_API/index.html new file mode 100644 index 0000000..a8f729d --- /dev/null +++ b/Existing_API_Collection/Cricket_Score_API/index.html @@ -0,0 +1,60 @@ + + + + + + Cricket Score Dashboard + + + + + + +
+
+

Current Matches

+
+ +
+
+
+

Live Scores

+
+ +
+
+
+

Player List

+
    + +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/Existing_API_Collection/Cricket_Score_API/script.js b/Existing_API_Collection/Cricket_Score_API/script.js new file mode 100644 index 0000000..cce08af --- /dev/null +++ b/Existing_API_Collection/Cricket_Score_API/script.js @@ -0,0 +1,71 @@ +// Function to fetch current matches +function fetchCurrentMatches() { + fetch('https://api.cricapi.com/v1/currentMatches?apikey=9df522d1-26ac-494c-9085-484911641a9f&offset=0') + .then(response => response.json()) + .then(data => { + const currentMatchesList = document.getElementById('currentMatchesList'); + currentMatchesList.innerHTML = ''; // Clear previous content + data.data.forEach(match => { + const matchCard = ` +
+
+
+
${match.name}
+

Status: ${match.status}

+

Venue: ${match.venue}

+

Date: ${match.date}

+
+
+
+ `; + currentMatchesList.innerHTML += matchCard; + }); + }); + } + + // Function to fetch live scores + function fetchLiveScores() { + fetch('https://api.cricapi.com/v1/cricScore?apikey=9df522d1-26ac-494c-9085-484911641a9f') + .then(response => response.json()) + .then(data => { + const liveScoresList = document.getElementById('liveScoresList'); + liveScoresList.innerHTML = ''; // Clear previous content + data.data.forEach(score => { + const scoreCard = ` +
+
+
+
${score.t1} vs ${score.t2}
+

Status: ${score.status}

+

Series: ${score.series}

+
+
+
+ `; + liveScoresList.innerHTML += scoreCard; + }); + }); + } + + // Function to fetch player list + function fetchPlayerList() { + fetch('https://api.cricapi.com/v1/players?apikey=9df522d1-26ac-494c-9085-484911641a9f&offset=0') + .then(response => response.json()) + .then(data => { + const playerListItems = document.getElementById('playerListItems'); + playerListItems.innerHTML = ''; // Clear previous content + data.data.forEach(player => { + const playerItem = ` +
  • ${player.name} - ${player.country}
  • + `; + playerListItems.innerHTML += playerItem; + }); + }); + } + + // Fetch data when the page loads + document.addEventListener('DOMContentLoaded', () => { + fetchCurrentMatches(); + fetchLiveScores(); + fetchPlayerList(); + }); \ No newline at end of file diff --git a/Existing_API_Collection/README.md b/Existing_API_Collection/README.md index ee919a6..a0974d0 100644 --- a/Existing_API_Collection/README.md +++ b/Existing_API_Collection/README.md @@ -16,6 +16,7 @@ |[Product Store API](./ProductStoreAPI/)| A Product Store API using NodeJS, ExpressJS, MongoDB and Mongoose | |[Bored API](./BoredAPI/)|Bored API is a versatile tool designed to provide users with random activity suggestions when they're feeling bored. With this API, users can access a wide range of activities to spark inspiration and alleviate boredom. From creative hobbies to outdoor adventures, Bored API offers something for everyone.| |[Unsplash API](./unsplashApi/)| An API that enables users to retrieve high quality and copyright free Images from Unsplash and also get random Images | +|[Cricket API](./Cricket_Score_API/)| this api gives all the current matches and upcoming matches also give scores of current matches and gives players list | |[NewsBuster](./news-buster-api/)|This API helps you gain worldly knowledge with a better frontend by fetching API | |[GeoAPI](./GeoAPI/)| GeoAPI is a simple RESTful API that allows you to convert addresses to geographic coordinates (latitude and longitude) and vice versa. This API is built using Node.js and Express.|