2.2.0 • Published 3 years ago

node-sport-api v2.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

node-sport-api

If you search an api or module which give you a sport team info with all it's players info, you’re at the good place

We Support: "Soccer", "Motorsport", "Fighting", "Baseball", "Basketball", "American Football", "Ice Hockey", "Golf", "Rugby", "Tennis", "Cricket", "Cycling", "Australian Football", "ESports", "Volleyball", "Netball", "Handball", "Snooker", "Field Hockey", "Darts"

GitLab

For Issues --> GitLab Issues

Install

via npm

$ npm install node-sport-api --save

Use

Get Supported sports

const {sportApi} = require("node-sport-api");

const supportedSports = await sportApi.getSupportedSport(teamName).catch((error) => {
    console.log(error);
    return error;
})
console.log(supportedSports);

//Output:
// [
//   "Soccer",
//   "Motorsport",
//   "Fighting",
//   "Baseball",
//   "Basketball",
//   "American Football",
//   "Ice Hockey",
//   "Golf",
//   "Rugby",
//   "Tennis",
//   "Cricket",
//   "Cycling",
//   "Australian Football",
//   "ESports",
//   "Volleyball",
//   "Netball",
//   "Handball",
//   "Snooker",
//   "Field Hockey",
//   "Darts"
// ]

Get team data by name

const {sportApi} = require("node-sport-api");

const teamName = "chelsea";

//-------For no specific sport----------------------------
const teamData = await sportApi.searchSportTeam(teamName).catch((error) => {
    console.log(error);
    return error;
})
//-------For a specific Sport-----------------------------
const sport = "soccer" //We Support: "Soccer", "Motorsport", "Fighting", "Baseball", "Basketball", "American Football", "Ice Hockey", "Golf", "Rugby", "Tennis", "Cricket", "Cycling", "Australian Football", "ESports", "Volleyball", "Netball", "Handball", "Snooker", "Field Hockey", "Darts"
const teamData = await sportApi.searchSportTeam(teamName,"soccer").catch((error) => {
    console.log(error);
    return error;
})
//-----------------------------------

console.log(teamData);

//Output:
// {
//     "teamFound": true,
//     "team": {
//       "idTeam": "133610",
//       "idSoccerXML": "15",
//       "idAPIfootball": "49",
//       "intLoved": "5",
//       "strTeam": "Chelsea",
//       "strTeamShort": "CHE",
//       "strAlternate": "Chelsea FC",
//       "intFormedYear": "1905",
//       "strSport": "Soccer",
//       "strLeague": "English Premier League",
//       "idLeague": "4328",
//       "strLeague2": "UEFA Champions League",
//       "idLeague2": "4480",
//       "strLeague3": "FA Cup",
//       "idLeague3": "4482",
//       "strLeague4": "EFL Cup",
//       "idLeague4": "4570",
//       "strLeague5": "",
//       "idLeague5": null,
//       "strLeague6": "",
//       "idLeague6": null,
//       "strLeague7": "",
//       "idLeague7": null,
//       "strDivision": null,
//       "strManager": "",
//       "strStadium": "Stamford Bridge",
//       "strKeywords": "The Blues, The Pensioners",
//       "strRSS": "http://feeds.feedburner.com/chelseafc/latestnews",
//       "strStadiumThumb": "https://www.thesportsdb.com/images/media/team/stadium/vpuxsx1420200157.jpg",
//       "strStadiumDescription": "Stamford Bridge (/ˈstæm.fərd ˈbrɪdʒ/) is a football stadium located in Fulham, London. It is the home ground of Chelsea F.C.. The stadium is located within the Moore Park Estate also known as Walham Green and is often referred to as simply The Bridge. The capacity is 41,798, making it the eighth largest ground in the Premier League.\r\n\r\nOpened in 1877, the stadium was used by the London Athletic Club until 1905, when new owner Gus Mears founded Chelsea Football Club to occupy the ground; Chelsea have played their home games there ever since. It has undergone numerous major changes over the years, most recently in the 1990s when it was renovated into a modern, all-seater stadium.\r\n\r\nStamford Bridge has been used as a venue for England international matches, FA Cup Finals, FA Cup semi-finals and Charity Shield games. It has also hosted numerous other sports, such as cricket, rugby union, speedway, greyhound racing, baseball and American football. The stadium's highest official attendance is 82,905, for a league match between Chelsea and Arsenal on 12 October 1935.",
//       "strStadiumLocation": "Fulham, London",
//       "intStadiumCapacity": "41798",
//       "strWebsite": "www.chelseafc.com",
//       "strFacebook": "www.facebook.com/ChelseaFC",
//       "strTwitter": "twitter.com/chelseafc",
//       "strInstagram": "www.instagram.com/chelseafc",
//       "strDescriptionEN": "Chelsea Football Club /ˈtʃɛlsiː/ are a professional football club based in Fulham, London, who play in the Premier League, the highest level of English football. Founded in 1905, the club have spent most of their history in the top tier of English football. The club's home ground is the 41,837-seat Stamford Bridge stadium, where they have played since their establishment.\r\n\r\nChelsea had their first major success in 1955, winning the league championship, and won various cup competitions during the 1960s, 1970s, 1990s and 2000s. The club have enjoyed their greatest period of success in the past two decades, winning 15 major trophies since 1997. Domestically, Chelsea have won four league titles, seven FA Cups, four League Cups and four FA Community Shields, while in continental competitions they have won two UEFA Cup Winners' Cups, one UEFA Super Cup, one UEFA Europa League and one UEFA Champions League. Chelsea are the only London club to win the UEFA Champions League, and one of four clubs, and the only British club, to have won all three main UEFA club competitions.\r\n\r\nChelsea's regular kit colours are royal blue shirts and shorts with white socks. The club's crest has been changed several times in attempts to re-brand the club and modernise its image. The current crest, featuring a ceremonial lion rampant regardant holding a staff, is a modification of the one introduced in the early 1950s. The club have sustained the fifth highest average all-time attendance in English football. Their average home gate for the 2012–13 season was 41,462, the sixth highest in the Premier League. Since July 2003, Chelsea have been owned by Russian billionaire Roman Abramovich. In April 2013 they were ranked by Forbes Magazine as the seventh most valuable football club in the world, at £588 million ($901 million), an increase of 18% from the previous year.",
//       "strDescriptionDE": null,
//       "strDescriptionFR": null,
//       "strDescriptionCN": null,
//       "strDescriptionIT": null,
//       "strDescriptionJP": null,
//       "strDescriptionRU": null,
//       "strDescriptionES": null,
//       "strDescriptionPT": null,
//       "strDescriptionSE": null,
//       "strDescriptionNL": null,
//       "strDescriptionHU": null,
//       "strDescriptionNO": null,
//       "strDescriptionIL": null,
//       "strDescriptionPL": null,
//       "strGender": "Male",
//       "strCountry": "England",
//       "strTeamBadge": "https://www.thesportsdb.com/images/media/team/badge/yvwvtu1448813215.png",
//       "strTeamJersey": "https://www.thesportsdb.com/images/media/team/jersey/30fgfl1599924943.png",
//       "strTeamLogo": "https://www.thesportsdb.com/images/media/team/logo/urupss1421777612.png",
//       "strTeamFanart1": "https://www.thesportsdb.com/images/media/team/fanart/rppwtt1424447399.jpg",
//       "strTeamFanart2": "https://www.thesportsdb.com/images/media/team/fanart/qtqrus1424447422.jpg",
//       "strTeamFanart3": "https://www.thesportsdb.com/images/media/team/fanart/tws3yo1548279989.jpg",
//       "strTeamFanart4": "https://www.thesportsdb.com/images/media/team/fanart/wwuput1421778515.jpg",
//       "strTeamBanner": "https://www.thesportsdb.com/images/media/team/banner/twxrxv1421778197.jpg",
//       "strYoutube": "www.youtube.com/user/chelseafc",
//       "strLocked": "unlocked",
//       "players": [
//         {
//           "idPlayer": "34148475",
//           "idTeam": "133610",
//           "idTeam2": null,
//           "idTeamNational": null,
//           "idSoccerXML": "15",
//           "idAPIfootball": "2278",
//           "idPlayerManager": "67074359",
//           "strNationality": "Spain",
//           "strPlayer": "Marcos Alonso",
//           "strTeam": "Chelsea",
//           "strTeam2": null,
//           "strSport": "Soccer",
//           "intSoccerXMLTeamID": "83",
//           "dateBorn": "1990-12-28",
//           "strNumber": "3",
//           "dateSigned": "2013-07-01",
//           "strSigning": "£23,000,000",
//           "strWage": "£5,200,000 (£100,000 a week)",
//           "strOutfitter": "",
//           "strKit": "Nike Phantom VNM",
//           "strAgent": "LIAN SPORTS",
//           "strBirthLocation": "Madrid, Spain",
//           "strDescriptionEN": "Marcos Alonso Mendoza (born 28 December 1990) is a Spanish professional footballer who plays for English club Chelsea as a left back or midfielder.\r\n\r\nHe started his career with Real Madrid, going on to represent mainly Bolton Wanderers in England – where he amassed Premier League totals of nine games and one goal over the course of two seasons, spending three in total with the club – and Fiorentina from Italy.\r\n\r\nBorn in Madrid, Alonso joined Real Madrid's youth academy still a child, going on to represent every youth side in the following years. In 2008 he reached Real Madrid Castilla which competed in Segunda División B, and first appeared for the reserve team on 22 February 2008, playing the entire game in a 0–1 home loss against AD Alcorcón.\r\n\r\nOn 11 December 2009, Alonso was first summoned by the main squad – coached by Manuel Pellegrini – for a La Liga match at Valencia CF. Eventually, he did not make the final list of 18, and his debut arrived on 4 April of the following year as he came on as a substitute for Gonzalo Higuaín in the 90th minute of a 2–0 win at Racing de Santander.",
//           "strDescriptionDE": null,
//           "strDescriptionFR": null,
//           "strDescriptionCN": null,
//           "strDescriptionIT": null,
//           "strDescriptionJP": null,
//           "strDescriptionRU": null,
//           "strDescriptionES": null,
//           "strDescriptionPT": null,
//           "strDescriptionSE": null,
//           "strDescriptionNL": null,
//           "strDescriptionHU": null,
//           "strDescriptionNO": null,
//           "strDescriptionIL": null,
//           "strDescriptionPL": null,
//           "strGender": "Male",
//           "strSide": "Left",
//           "strPosition": "Defender",
//           "strCollege": null,
//           "strFacebook": "www.facebook.com/marcosalonsoMA3/?fref=ts",
//           "strWebsite": "",
//           "strTwitter": "twitter.com/marcosalonso03",
//           "strInstagram": "www.instagram.com/marcosalonso28",
//           "strYoutube": "",
//           "strHeight": "1.88 m (6 ft 2 in)",
//           "strWeight": "79.37",
//           "intLoved": "0",
//           "strThumb": "https://www.thesportsdb.com/images/media/player/thumb/sryxpv1472675352.jpg",
//           "strCutout": "https://www.thesportsdb.com/images/media/player/cutout/psb0501557998098.png",
//           "strRender": "https://www.thesportsdb.com/images/media/player/render/5ik5pu1557998106.png",
//           "strBanner": null,
//           "strFanart1": "https://www.thesportsdb.com/images/media/player/fanart/w2h36e1514551989.jpg",
//           "strFanart2": "https://www.thesportsdb.com/images/media/player/fanart/0k5j4t1514552063.jpg",
//           "strFanart3": "https://www.thesportsdb.com/images/media/player/fanart/hy3fkt1514552033.jpg",
//           "strFanart4": "https://www.thesportsdb.com/images/media/player/fanart/l8g52a1514552025.jpg",
//           "strCreativeCommons": "No",
//           "strLocked": "unlocked"
//         },
//       ]
//     }
//   }

Get player data by name

const {sportApi} = require("node-sport-api");

const playerName = "michael jordan";
const player = await sportApi.searchPlayer(playerName).catch((error) => {
    console.log(error);
    return error;
})
console.log(player);

//Output:
// {
//     "playerFound": true,
//     "player": {
//       "idPlayer": "34159867",
//       "idTeam": "135182",
//       "idTeam2": "0",
//       "idTeamNational": null,
//       "idSoccerXML": "0",
//       "idAPIfootball": null,
//       "idPlayerManager": null,
//       "strNationality": "United States",
//       "strPlayer": "Michael Jordan",
//       "strTeam": "_Retired Basketball",
//       "strTeam2": "",
//       "strSport": "Basketball",
//       "intSoccerXMLTeamID": null,
//       "dateBorn": "1963-02-17",
//       "strNumber": "23",
//       "dateSigned": null,
//       "strSigning": "",
//       "strWage": "",
//       "strOutfitter": "",
//       "strKit": "",
//       "strAgent": "",
//       "strBirthLocation": "Brooklyn, New York, USA",
//       "strDescriptionEN": "Michael Jeffrey Jordan (born February 17, 1963), also known by his initials, MJ, is an American former professional basketball player, entrepreneur, and principal owner and chairman of the Charlotte Hornets. He played 15 seasons in the National Basketball Association (NBA) for the Chicago Bulls and Washington Wizards. His biography on the NBA website states: \"By acclamation, Michael Jordan is the greatest basketball player of all time.\"Jordan was one of the most effectively marketed athletes of his generation and was considered instrumental in popularizing the NBA around the world in the 1980s and 1990s.\r\n\r\nAfter a three-season career at the University of North Carolina at Chapel Hill, where he was a member of the Tar Heels' national championship team in 1982, Jordan joined the NBA's Chicago Bulls in 1984. He quickly emerged as a league star, entertaining crowds with his prolific scoring. His leaping ability, illustrated by performing slam dunks from the free throw line in slam dunk contests, earned him the nicknames \"Air Jordan\" and \"His Airness\". He also gained a reputation for being one of the best defensive players in basketball. In 1991, he won his first NBA championship with the Bulls, and followed that achievement with titles in 1992 and 1993, securing a \"three-peat\". Although Jordan abruptly retired from basketball before the beginning of the 1993–94 NBA season to pursue a career in baseball, he rejoined the Bulls in 1995 and led them to three additional championships in 1996, 1997, and 1998, as well as an NBA-record 72 regular-season wins in the 1995–96 NBA season. Jordan retired for a second time in 1999, but returned for two more NBA seasons from 2001 to 2003 as a member of the Wizards.\r\n\r\nJordan's individual accolades and accomplishments include five Most Valuable Player (MVP) Awards, ten All-NBA First Team designations, nine All-Defensive First Team honors, fourteen NBA All-Star Game appearances, three All-Star Game MVP Awards, ten scoring titles, three steals titles, six NBA Finals MVP Awards, and the 1988 NBA Defensive Player of the Year Award. Among his numerous accomplishments, Jordan holds the NBA records for highest career regular season scoring average (30.12 points per game) and highest career playoff scoring average (33.45 points per game). In 1999, he was named the greatest North American athlete of the 20th century by ESPN, and was second to Babe Ruth on the Associated Press's list of athletes of the century. He is a two-time inductee into the Basketball Hall of Fame – in 2009 for his individual career, and in 2010 as a member of the 1992 United States men's Olympic basketball team (\"The Dream Team\").\r\n\r\nJordan is also known for his product endorsements. He fueled the success of Nike's Air Jordan sneakers, which were introduced in 1985 and remain popular today. Jordan also starred in the 1996 feature film Space Jam as himself. In 2006, he became part-owner and head of basketball operations for the then-Charlotte Bobcats, buying controlling interest in 2010.",
//       "strDescriptionDE": null,
//       "strDescriptionFR": null,
//       "strDescriptionCN": null,
//       "strDescriptionIT": null,
//       "strDescriptionJP": null,
//       "strDescriptionRU": "Майкл Дже́ффри Джо́рдан (англ. Michael Jeffrey Jordan; родился 17 февраля 1963 года, Бруклин, Нью-Йорк) — американский баскетболист, бывший игрок НБА. Играл на позиции атакующего защитника. Джордан сыграл важную роль в популяризации баскетбола и НБА во всём мире в 1980-х и 1990-х годах.\r\n\r\nПосле начала карьеры в команде Университета Северной Каролины (1982—1984), с которой он выиграл чемпионат NCAA 1982 года, Джордан присоединился к команде «Чикаго Буллз» в 1984 году. За феноменальную прыгучесть Майкл получил прозвища «Воздушный Джордан» (англ. Air Jordan) и «Его Воздушество» (англ. His Airness). Он также считается одним из лучших защитников в истории баскетбола[5]. В 1991 году он выиграл свой первый чемпионат НБА с «Буллз», в 1992 и 1993 годах повторил этот успех. После гибели отца в начале сезона 1993/94 Джордан внезапно ушёл из баскетбола и попытался сделать карьеру в бейсболе. В 1995 году он вернулся на площадку и помог «Буллз» завоевать ещё три титула (1996, 1997 и 1998), попутно установив вместе с командой рекорд НБА на тот момент по количеству выигранных матчей в течение регулярного сезона — 72 победы (сезон 1995/96). Во второй раз Джордан завершил карьеру в 1999 году, но вернулся ещё на два сезона в 2001 году в качестве игрока «Вашингтон Уизардс».\r\n\r\nВ 1984 году Джордан заключил рекламный контракт с фирмой Nike, которая специально для Майкла разработала кроссовки Air Jordan. Проект был настолько успешен, что впоследствии Air Jordan стали самостоятельным брендом. Джордан сыграл самого себя в художественном фильме «Космический джем» (1996). Входит в руководящий состав компании Oakley Inc. Сейчас является основным владельцем, а также руководителем по баскетбольным операциям клуба «Шарлотт Хорнетс». В феврале 2010 года выиграл торги на право выкупить контрольный пакет акций команды у основного владельца Роберта Л. Джонсона. Таким образом, Майкл стал первым игроком ассоциации, владеющим клубом НБА. Майкл Джордан стал первым спортсменом-миллиардером, и его состояние составляет около 1 млрд долларов.\r\n\r\nПо рейтингу Forbes Майкл Джордан самый высокооплачиваемый спортсмен за всю историю. Если перевести все заработанные им деньги в доллары по курсу 2017 года, то это получается $1,85 млрд. Помимо зарплаты и многочисленных премий немалую часть своего состояния Джордан получил благодаря рекламным контрактам. ",
//       "strDescriptionES": "Michael Jeffrey Jordan (Brooklyn, 17 de febrero de 1963), conocido como Michael Jordan y apodado «His Airness» («Su Aireza») y «Air Jordan», es un exjugador de baloncesto estadounidense. En la actualidad, es el propietario de los Charlotte Hornets, franquicia de la NBA.2 Está considerado por la mayoría de aficionados y especialistas como el mejor jugador de baloncesto de todos los tiempos.3 Se retiró definitivamente en 2003, tras haberlo hecho en dos ocasiones anteriores, en 1993 y 1999.\r\n\r\nGanó seis anillos con Chicago Bulls, promediando 30,1 puntos por partido en toda su carrera, el mayor promedio en la historia de la liga. También ganó 10 títulos de máximo anotador, 5 MVP de la temporada, 6 MVP de las Finales, nombrado en el mejor quinteto de la NBA en diez ocasiones, en el defensivo nueve veces, líder en robos de balón durante tres años y un premio al mejor defensor de la temporada.\r\n\r\nDesde 1983, ha aparecido en la portada de la prestigiosa revista deportiva Sports Illustrated en 50 ocasiones, todo un récord, además de ser nombrado \"Deportista del Año\" en 1991. Fue nombrado \"mejor atleta del siglo XX\" por ESPN y segundo tras Babe Ruth por Associated Press.",
//       "strDescriptionPT": null,
//       "strDescriptionSE": null,
//       "strDescriptionNL": null,
//       "strDescriptionHU": null,
//       "strDescriptionNO": null,
//       "strDescriptionIL": null,
//       "strDescriptionPL": null,
//       "strGender": "Male",
//       "strSide": "Right",
//       "strPosition": "Shooting Guard",
//       "strCollege": null,
//       "strFacebook": "",
//       "strWebsite": "",
//       "strTwitter": "",
//       "strInstagram": "",
//       "strYoutube": "",
//       "strHeight": "6 ft 6 in (1.98 m)",
//       "strWeight": "216 lb (98 kg)",
//       "intLoved": "2",
//       "strThumb": "https://www.thesportsdb.com/images/media/player/thumb/9v0oo31540061725.jpg",
//       "strCutout": "https://www.thesportsdb.com/images/media/player/cutout/dlobne1557869354.png",
//       "strRender": "https://www.thesportsdb.com/images/media/player/render/kws56i1557676783.png",
//       "strBanner": "https://www.thesportsdb.com/images/media/player/banner/opm6aw1594548286.jpg",
//       "strFanart1": "https://www.thesportsdb.com/images/media/player/fanart/yvvwvv1424598703.jpg",
//       "strFanart2": "https://www.thesportsdb.com/images/media/player/fanart/tuqwxr1472158080.jpg",
//       "strFanart3": "https://www.thesportsdb.com/images/media/player/fanart/rvxwrr1472159496.jpg",
//       "strFanart4": "https://www.thesportsdb.com/images/media/player/fanart/qqxsqy1472159590.jpg",
//       "strCreativeCommons": "No",
//       "strLocked": "unlocked"
//     }
//   }
2.2.0

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago