-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (16 loc) · 859 Bytes
/
script.js
File metadata and controls
25 lines (16 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
async function getMatchData() {
return await fetch("https://api.cricapi.com/v1/currentMatches?apikey=a8c19d53-1e77-4d72-8ae5-b43ec49cb7c8&offset=0")
.then(data => data.json())
.then(data => {
if (data.status != "success") return;
const matchesList = data.data;
if (!matchesList) return [];
//add your api key from cricketdata.org
const relevantData = matchesList.filter(match => match.series_id == "c75f8952-74d4-416f-b7b4-7da4b4e3ae6e").map(match => `${match.name}, ${match.status}`);
console.log({ relevantData });
document.getElementById("matches").innerHTML = relevantData.map(match => `<li>${match} </li>`).join('');
return relevantData;
})
.catch(e => console.log(e));
}
getMatchData();