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.
- Toon info parsing
- Login support
- Added Ally methods to use allyCode
- Trim toon description
- fix star count on ships
- Update static and dependencies
- Remove
collectionScore
property from the contract, since swogh.gg doesn't provide it anymore - Add
profileAlly(allyCode)
method, same asprofile(username)
but you pass the ally,username
will be dropped. username
is no longerswgoh.gg
username, now isplayername
, username will be dropped.
- Add guild information #14 - add guild information
- Update static and dependencies
- Cache for Characters & Ship stats
- Fix profile parser when the user doesn't have a guild #13 - panelMenus nodeValue = null
- Cache for Characters & Ship stats
- Added playername to profile #12 - swgoh.profile should return also the profile's character name
- Add static images(toon/ships) to the static folder #10 - Static resource links are not working
- Cache for Characters & Ship stats
- Fix #8 - collection method not returning the full collection
- Cache for Characters (Bossk added)
- Improved retrieving mods performance
- Added lastUpdatedUTC to profile #5
- Updated cached files
- Cache for Characters & Ship stats
- Added Jest Tests
- Player mods collection
- Fix 7* ships not parse star correctly (#3)
- Added guild units fetch (Same as the swgoh guild unit API )
- Fix "Profile Data undefined" when not showing AllyCode on Swgoh (#2)
- Added support for ships
- Fixed issue with stars when getting collection
- First release, support collection (toons), player info and guild info.
The developer of this application does not have any affiliation with the Capital Games, Disney, Lucasfilm Limited or swgoh.gg.