Get statistics from all of your favourite social media sites, games and more!
Install
$ npm install statisfy
📖 Documentation
NPM
Functions
CommonJS Usage
const { npm } = require("statisfy");
async function getNPM(pkg) => {
const result = await npm(pkg);
console.log(result);
}
getNPM("statisfy")
ES6 Usage
import { npm } from "statisfy";
async function getNPM(pkg) => {
const result = await npm(pkg);
console.log(result);
}
getNPM("statisfy")
Result
{
name: 'statisfy',
scope: 'unscoped',
version: '1.0.2',
description: 'Get statistics from all of your favourite social media sites, games and more!',
keywords: [ 'stats', 'statistics', 'social', 'media', 'api' ],
date: '2021-08-24T20:11:48.377Z',
links: {
npm: 'https://www.npmjs.com/package/statisfy',
homepage: 'https://github.com/aspekts/statisfynpm#readme',
repository: 'https://github.com/aspekts/statisfynpm',
bugs: 'https://github.com/aspekts/statisfynpm/issues'
},
author: { name: 'Aspekts' },
publisher: { username: 'aspekts', email: 'aspektsbuisness@gmail.com' },
maintainers: [ { username: 'aspekts', email: 'aspektsbuisness@gmail.com' } ]
}
Twitch
Getting Client ID and Client Secret
Head to https://dev.twitch.tv/console and login with your twitch acccount.
From there you will find you will need to register a new application.
Inside the application you will see your Client ID.
You can generate a Client Secret by completing the captcha and selecting "New Secret".
Functions
- getUserByName
- getUserByID
- getChannelInfo
- searchChannels
- getToken
CommonJS Example Usage
const { Twitch } = require("statisfy");
const ttv = new Twitch({
client_id : "12345abcde",
client_secret: "67890fghij"
});
async function channelInfo() {
const info = await ttv.getUserByName("Ludwig");
console.log(info)
}
channelInfo()
ES6 Example Usage
import { Twitch } from "statisfy";
const ttv = new Twitch({
client_id : "12345abcde",
client_secret: "67890fghij"
});
async function channelInfo() {
const info = await ttv.getUserByName("Ludwig");
console.log(info)
}
channelInfo()
Result
{
id: '201761728',
login: 'aspekts',
display_name: 'Aspekts',
type: '',
broadcaster_type: '',
description: "I'm Aspekts. A regular guy who has like no viewers or followers trying to have fun really. Follow if want, it's up to you honestly (PLEASE DO) ",
profile_image_url: 'https://static-cdn.jtvnw.net/jtv_user_pictures/2b6fd40a-33c9-4a4b-a0c8-eb8169f836ae-profile_image-300x300.png',
offline_image_url: 'https://static-cdn.jtvnw.net/jtv_user_pictures/65dcb42c-a22d-445d-a2bd-01e3e15ca510-channel_offline_image-1920x1080.jpeg',
view_count: 188,
created_at: '2018-03-03T18:01:17Z'
}
Functions
CommonJS Example Usage
const { Twitter } = require("statisfy");
const twt = new Twitter({
token: "ABCD1234"
})
async function twttest() {
const result = await twt.UserLookupByName("POTUS")
console.log(result)
}
twttest()
Result
{
created_at: '2021-01-13T00:37:08.000Z',
public_metrics: {
followers_count: 13665857,
following_count: 12,
tweet_count: 1372,
listed_count: 13037
},
protected: false,
verified: true,
url: 'https://t.co/IxLjEB2zlE',
id: '1349149096909668363',
description: '46th President of the United States, husband to @FLOTUS, proud dad & pop. Tweets may be archived: https://t.co/IURuMIrzxb',
username: 'POTUS',
entities: {
url: { urls: [Array] },
description: { urls: [Array], mentions: [Array] }
},
profile_image_url: 'https://pbs.twimg.com/profile_images/1380530524779859970/TfwVAbyX_normal.jpg',
name: 'President Biden'
}
TRN (ALPHA)
Functions
CommonJS Example Usage
const { TRN } = require("statisfy");
const trn = new TRN({
key:"ABC1234"
});
async function apextest() {
const result = await trn.ApexLegends({
username:'xAspekts',
platform: "xbl"
});
console.log(result)
}
apextest()
async function fntest(){
const result = await trn.Fortnite({
username:'Ninja',
platform:'kbm'
})
console.log(result)
}
fntest()
Results - Apex Legends
{
platformInfo: {
platformSlug: 'xbl',
platformUserId: 'xAspekts',
platformUserHandle: 'xAspekts',
platformUserIdentifier: 'xAspekts',
avatarUrl: 'https://images-eds-ssl.xboxlive.com/image?url=wHwbXKif8cus8csoZ03RW8ke8ralOdP9BGd4wzwl0MJ9z6QzuGwZjtvbE7sSsMVW3GtqdB8tr2M604Js_A5hRb4ej1NAlLgfikoRUkt8XGoBbs9TId_M9.NIOpyumXn9la5RYDGV9y_fYQlPsMeH74.dFI.YBGHTHVD6_tFiUCo-',
additionalParameters: null
},
userInfo: {
userId: 4668724,
isPremium: false,
isVerified: false,
isInfluencer: false,
isPartner: false,
countryCode: 'GB',
customAvatarUrl: null,
customHeroUrl: null,
socialAccounts: [],
pageviews: 6,
isSuspicious: null
},
metadata: {
currentSeason: 2,
activeLegend: 'legend_13',
activeLegendName: 'Loba',
activeLegendStats: [ 'Season 8 Wins', 'Kills' ]
},
segments: [
{
type: 'overview',
attributes: {},
metadata: [Object],
expiryDate: '2022-01-29T14:29:21.2766514+00:00',
stats: [Object]
},
{
type: 'legend',
attributes: [Object],
metadata: [Object],
expiryDate: '2022-01-29T14:29:21.2766514+00:00',
stats: [Object]
},
{
type: 'legend',
attributes: [Object],
metadata: [Object],
expiryDate: '2022-01-29T14:29:21.2766514+00:00',
stats: [Object]
}
],
availableSegments: [ { type: 'legend', attributes: {}, metadata: {} } ],
expiryDate: '2022-01-29T14:29:21.2766514+00:00'
}
Problems or issues?
If you encounter any problems, bugs or other issues with the package, please create an issue in the GitHub repo.
Contact
If you have any questions or just want to reach me, you can get in touch with me on my Discord server.