swgoh is providing an API at https://swgoh.gg/api/, I strongly recommend using that, because this library currently is scrapping data from HTML. I will probably move this library to use swgoh.gg API, but that will be a breaking change and not backwards compatible because the interface contract will change aka the data return will be different.
Node library to get information of swgoh parsing swgoh.gg, you can get profile, characters, guild members, ships, units and mods.
const swgoh = require("swgoh").swgoh
//or
import {swgoh} from 'swgoh';
const username= "pikax";
swgoh.profile(username).then(function (p) {
console.log(p);
return swgoh.guild(p.guildUrl);
}).then(console.log);
swgoh.collection(username).then(console.log);
swgoh.ship(username).then(console.log);
const allyCode= "495616697";
swgoh.profileAlly(allyCode).then(console.log);
swgoh.collectionAlly(allyCode).then(console.log);
swgoh.shipAlly(allyCode).then(console.log);
swgoh.modsAlly(allyCode).then(console.log);
const guild = "/g/232/requiem/"; // or {id:232}
swgoh.units(guild).then(console.log);
swgoh.guild(guild).then(console.log);
swgoh.mods(username).then(console.log);
// login
const user = {
username: 'pikax',
password: 'MySuperSecurePassword'
}
swgoh.login(user.username, user.password); //Promise<boolean>
//cached characters & ships
import {getCharacters, getShips} from 'swgoh';
The asset location by default is to swogh/static/img, but you can reset to swgoh.gg using
the environment config USE_SWGOH_ASSET=1
in code:
process.env.USE_SWGOH_ASSET = 1;
import {swgoh} from 'swgoh';
You can set a custom asset location by specifying it using environment config SWGOH_ASSET_LOCATION={assetpath}
in code
process.env.SWGOH_ASSET_LOCATION = "https://assets.mysupawebsite.web/swgoh";
import {swgoh} from 'swgoh';
With TB just released, this library provides easy way to get data from swgoh.gg
yarn add swgoh
npm i swgoh
All notable changes to this project will be documented in this file.
swgoh.gg is capping the number of mods you can get in your profile, I can't fix this without making breaking changes, you should use swoghApi.
collectionScore
property from the contract, since swogh.gg doesn't provide it anymoreprofileAlly(allyCode)
method, same as profile(username)
but you pass the ally, username
will be dropped.username
is no longer swgoh.gg
username, now is playername
, username will be dropped.The developer of this application does not have any affiliation with the Capital Games, Disney, Lucasfilm Limited or swgoh.gg.