Skip to content

Commit

Permalink
add data in player list
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol Varma committed Mar 31, 2020
1 parent ca0397b commit 6d7f2ae
Show file tree
Hide file tree
Showing 4 changed files with 321 additions and 35 deletions.
64 changes: 31 additions & 33 deletions getTeamLogoMapping.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
// const axios = require('axios');

// const leagueId = [
// 4328, // English Premier League
// 4331, // German Bundesliga
// 4332, // Italian Serie A
// 4334, // French Ligue 1
// 4335, // Spanish La Liga
// 4344, // Portuguese Primeira Liga
// 4346, // American Major League Soccer
// 4351, // Brazilian Brasileirao
// 4359 // Chinese Super League
// ]

// const API_KEY = 1

// Promise.all(
// leagueId.map(async lid => {
// const { data: { teams: teamList } } = await axios.get(`https://www.thesportsdb.com/api/v1/json/${API_KEY}/lookup_all_teams.php?id=${lid}`);
// return teamList.map(({ strTeam, strTeamBadge }) => ({
// name: strTeam.toLowerCase(),
// logo: strTeamBadge
// }))
// })
// ).then(parsedTeamList => console.log(JSON.stringify(Array.prototype.concat.apply([], parsedTeamList))))

const abc = require("./src/data/team-logo.json")

const ans = {};

abc.map(({ name, logo }) => ans[name] = logo);

console.log(JSON.stringify(ans));
const axios = require('axios');

const leagueId = [
4328, // English Premier League
4331, // German Bundesliga
4332, // Italian Serie A
4334, // French Ligue 1
4335, // Spanish La Liga
4337, // Dutch Eredivisie
4344, // Portuguese Primeira Liga
4346, // American Major League Soccer
4351, // Brazilian Brasileirao
4359 // Chinese Super League
]

const API_KEY = 1
let abc;
Promise.all(
leagueId.map(async lid => {
const { data: { teams: teamList } } = await axios.get(`https://www.thesportsdb.com/api/v1/json/${API_KEY}/lookup_all_teams.php?id=${lid}`);
return teamList.map(({ strTeam, strTeamBadge }) => ({
name: strTeam.toLowerCase(),
logo: strTeamBadge
}))
})
).then(parsedTeamList => {
abc = Array.prototype.concat.apply([], parsedTeamList)
const ans = {};
abc.map(({ name, logo }) => ans[name] = logo);
console.log(JSON.stringify(ans));
})

18 changes: 18 additions & 0 deletions src/jsons/team-logo.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@
"valencia": "https://www.thesportsdb.com/images/media/team/badge/yxwsqp1473503062.png",
"valladolid": "https://www.thesportsdb.com/images/media/team/badge/rvytvt1473503711.png",
"villarreal": "https://www.thesportsdb.com/images/media/team/badge/vrypqy1473503073.png",
"ado den haag": "https://www.thesportsdb.com/images/media/team/badge/vpvtqt1473534732.png",
"ajax": "https://www.thesportsdb.com/images/media/team/badge/9az3yz1534798587.png",
"az alkmaar": "https://www.thesportsdb.com/images/media/team/badge/wtqwvv1473534757.png",
"fc emmen": "https://www.thesportsdb.com/images/media/team/badge/knwhs41532855745.png",
"fc groningen": "https://www.thesportsdb.com/images/media/team/badge/twtvss1473534775.png",
"fc twente": "https://www.thesportsdb.com/images/media/team/badge/rsrxrt1473534783.png",
"fc utrecht": "https://www.thesportsdb.com/images/media/team/badge/txvxrx1473534794.png",
"feyenoord": "https://www.thesportsdb.com/images/media/team/badge/uturtx1473534803.png",
"fortuna sittard": "https://www.thesportsdb.com/images/media/team/badge/6z9a051513777590.png",
"pec zwolle": "https://www.thesportsdb.com/images/media/team/badge/qpvqwy1473534822.png",
"psv eindhoven": "https://www.thesportsdb.com/images/media/team/badge/xryxrq1473534831.png",
"rkc waalwijk": "https://www.thesportsdb.com/images/media/team/badge/6mw88p1488825141.png",
"sc heerenveen": "https://www.thesportsdb.com/images/media/team/badge/surtsx1473534841.png",
"sc heracles almelo": "https://www.thesportsdb.com/images/media/team/badge/vyyvss1473534851.png",
"sparta": "https://www.thesportsdb.com/images/media/team/badge/xsvwwp1464539632.png",
"vitesse": "https://www.thesportsdb.com/images/media/team/badge/wrptxp1473534864.png",
"vvv-venlo": "https://www.thesportsdb.com/images/media/team/badge/ii0fu01566053253.png",
"willem ii": "https://www.thesportsdb.com/images/media/team/badge/yqqrps1473534873.png",
"aves": "https://www.thesportsdb.com/images/media/team/badge/9yw8301512996625.png",
"belenenses": "https://www.thesportsdb.com/images/media/team/badge/7po4e21563652867.png",
"benfica": "https://www.thesportsdb.com/images/media/team/badge/7t684j1520879174.png",
Expand Down
272 changes: 271 additions & 1 deletion src/jsons/transfer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,275 @@
"real madrid",
"juventus"
]
},
{
"player_name": "alvaro morata",
"teams": [
"real madrid",
"juventus",
"real madrid",
"chelsea",
"ath madrid"
]
},
{
"player_name": "antoine griezmann",
"teams": [
"sociedad",
"ath madrid",
"barcelona"
]
},
{
"player_name": "gonzalo higuain",
"teams": [
"real madrid",
"napoli",
"juventus",
"milan",
"chelsea",
"juventus"
]
},
{
"player_name": "mohamed salah",
"teams": [
"chelsea",
"fiorentina",
"roma",
"liverpool"
]
},
{
"player_name": "toni kroos",
"teams": [
"bayern munich",
"leverkusen",
"bayern munich",
"real madrid"
]
},
{
"player_name": "alexis sanchez",
"teams": [
"udinese",
"barcelona",
"arsenal",
"man united",
"inter"
]
},
{
"player_name": "neymar",
"teams": [
"santos fc",
"barcelona",
"paris sg"
]
},
{
"player_name": "mario balotelli",
"teams": [
"inter",
"man city",
"milan",
"liverpool",
"milan",
"nice",
"marseille",
"brescia"
]
},
{
"player_name": "zlatan ibrahimovic",
"teams": [
"ajax",
"juventus",
"inter",
"barcelona",
"milan",
"paris sg",
"man united",
"l.a. galaxy",
"milan"
]
},
{
"player_name": "frank lampard",
"teams": [
"west ham",
"chelsea",
"man city",
"new york city"
]
},
{
"player_name": "david luiz",
"teams": [
"benfica",
"chelsea",
"paris sg",
"chelsea",
"arsenal"
]
},
{
"player_name": "xabi alonso",
"teams": [
"sociedad",
"eibar",
"liverpool",
"real madrid",
"bayern munich"
]
},
{
"player_name": "arjen robben",
"teams": [
"chelsea",
"real madrid",
"bayern munich"
]
},
{
"player_name": "mario mandzukic",
"teams": [
"wolfsburg",
"bayern munich",
"ath madrid",
"juventus"
]
},
{
"player_name": "fernando torres",
"teams": [
"ath madrid",
"liverpool",
"chelsea",
"milan",
"ath madrid"
]
},
{
"player_name": "samuel eto'o",
"teams": [
"real madrid",
"espanol",
"mallorca",
"barcelona",
"inter",
"chelsea",
"everton",
"sampdoria"
]
},
{
"player_name": "cesc fabregas",
"teams": [
"arsenal",
"barcelona",
"chelsea",
"monaco"
]
},
{
"player_name": "mesut ozil",
"teams": [
"schalke 04",
"werder bremen",
"real madrid",
"arsenal"
]
},
{
"player_name": "romelu lukaku",
"teams": [
"chelsea",
"everton",
"man united",
"inter"
]
},
{
"player_name": "zinedine zidane",
"teams": [
"bordeaux",
"juventus",
"real madrid"
]
},
{
"player_name": "kaka",
"teams": [
"sao paulo",
"milan",
"real madrid",
"milan",
"sao paulo",
"orlando city"
]
},
{
"player_name": "javier hernandez",
"teams": [
"man united",
"real madrid",
"leverkusen",
"west ham",
"sevilla",
"l.a. galaxy"
]
},
{
"player_name": "eden hazard",
"teams": [
"lille",
"chelsea",
"real madrid"
]
},
{
"player_name": "thibaut courtois",
"teams": [
"ath madrid",
"chelsea",
"real madrid"
]
},
{
"player_name": "mario gotze",
"teams": [
"dortmund",
"bayern munich",
"dortmund"
]
},
{
"player_name": "pierre-emerick aubameyang",
"teams": [
"milan",
"dijon",
"lille",
"monaco",
"st etienne",
"dortmund",
"arsenal"
]
},
{
"player_name": "henrikh mkhitaryan",
"teams": [
"dortmund",
"man united",
"arsenal",
"roma"
]
},
{
"player_name": "ilkay gundogan",
"teams": [
"dortmund",
"man city"
]
}
]
]
2 changes: 1 addition & 1 deletion src/styles/index.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.wrapperBox{
margin: auto;
transform: translateY(10%);
transform: translateY(1%);
background: #fff;
border-radius: 5px;
box-shadow: 0 4px 8px 0 #dddddd, 0 6px 20px 0 #dddddd;
Expand Down

0 comments on commit 6d7f2ae

Please sign in to comment.