sofifa.js
v3.0.0
Published
A simple and easy-to-use package to obtain player information from data from the sofifa.com website in addition to generating teams randomly.
Downloads
110
Maintainers
Readme
A simple and easy-to-use package to obtain player information from data from the sofifa.com website in addition to generating teams randomly. This library was created to meet the needs of a brazillian WhatsApp bot, however it is also available for public use.
To install this dependency to your project you must have Node.js installed on your machine.
If you already have Node.js installed on your machine, just run the following command in your terminal:
$ npm install sofifa.js@latest --save
Note: It is highly recommended that when installing this dependency you install the latest released version.
Retrieve Players
Retrieve a list of players based on specific filters.
import { retrievePlayers } from 'sofifa.js';
// Example: Retrieve players with specified filters (minium defense up to 50 and maxium defense up to 70)
retrievePlayers({ defl: 50, defh: 70 })
.then(console.log)
.catch(console.error);
Player Stats
Fetch detailed statistics of a player based on specific filters or a identificator (ID).
import { playerStats } from 'sofifa.js';
// Example: Fetch player stats with specified filters
playerStats({ keyword: 'Bellingham' })
.then(console.log)
.catch(console.error);
Get a random player
Search for a random player based on a minimum and maximum overall and define the inverse probability of the player with the highest overall coming.
import { getRandomPlayer } from 'sofifa.js';
// Example of how to get a random player with maxium and minium overall ratings
getRandomPlayer(47, 60)
.then((player) => console.log(`[${player.id}] ${player.fullName}`))
.catch(console.error);