The open-source library as a means of accessing the public R6Tab | Tabstats.com web API.
npm i --save @raz1el/r6tab
import R6TabAPI, { ServicePlatform, GamePlatform, Region } from "@raz1el/r6tab";
const r6tab = new R6TabAPI();
const r6tab = new R6TabAPI({ apiKey: "xxxxxxxxxxxx" });
// Get general stats (p_id, p_name, level ...)
r6tab.statsByName("Raz1el", ServicePlatform.UPLAY)
.then(res => {
console.log(res);
}).catch(console.error);
// Get detailed stats (p_id, p_name, level, general stats, ranked data ...)
r6tab.statsById("6311edf5-f022-481c-bc9b-b725b703d5e2")
.then(res => {
console.log(res);
}).catch(console.error);
// Request an stats update. Get stats similar to #.statsById
r6tab.statsUpdate("6311edf5-f022-481c-bc9b-b725b703d5e2")
.then(res => {
console.log(res);
}).catch(console.error);
// Get leaderboards
r6tab.statsLeaders(GamePlatform.WINDOWS, Region.ALL)
.then(res => {
console.log(res);
}).catch(console.error);
await r6tab.statsByName("Raz1el", ServicePlatform.PSN);
await r6tab.statsById("6311edf5-f022-481c-bc9b-b725b703d5e2");
await r6tab.statsUpdate("6311edf5-f022-481c-bc9b-b725b703d5e2");
await r6tab.statsLeaders(GamePlatform.WINDOWS, Region.ALL);
const res = await r6tab.statsByName("Raz1el", ServicePlatform.PSN);
if (res.found) {
console.log(res);
}
else {
console.log("data not found");
}
const res = await r6tab.statsById("6311edf5-f022-481c-bc9b-b725b703d5e2");
if (res.found) {
console.log(res);
}
else {
console.log("data not found");
}
const p_id = "6311edf5-f022-481c-bc9b-b725b703d5e2";
R6TabAPI.isPlayerId(p_id); // true
R6TabAPI.isPlayerId("xxxx-xxxx-xxxx-xxxx"); // false
R6TabAPI.getAvatarUrl(p_id); // https://ubisoft-avatars.akamaized.net/6311edf5-f022-481c-bc9b-b725b703d5e2/default_256_256.png
R6TabAPI.getProfileUrl(p_id); // https://tabstats.com/siege/player/6311edf5-f022-481c-bc9b-b725b703d5e2
https://github.com/raziEiL/r6tab/tree/master/src/json_response
If you want to thank me for the work feel free to send any amount.