
changelog
INFORMATION 2018-09-16
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.
Synopsis
Node library to get information of swgoh parsing swgoh.gg, you can get profile, characters, guild members, ships, units and mods.
Code Example
import
const swgoh = require("swgoh").swgoh
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/";
swgoh.units(guild).then(console.log);
swgoh.guild(guild).then(console.log);
swgoh.mods(username).then(console.log);
const user = {
username: 'pikax',
password: 'MySuperSecurePassword'
}
swgoh.login(user.username, user.password);
import {getCharacters, getShips} from 'swgoh';
Get swogh.gg assets
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';
Get custom asset location
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';
Motivation
With TB just released, this library provides easy way to get data from swgoh.gg
Installation
yarn add swgoh
npm i swgoh
Changelog
All notable changes to this project will be documented in this file.
KNOWN issues
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.
[Unreleased]
- Toon info parsing
- Login support
[0.8.0] 2018-10-30
- Added Ally methods to use allyCode
[0.7.1] 2018-09-16
- Trim toon description
- fix star count on ships
[0.7.0] 2018-09-15
- Update static and dependencies
- Remove
collectionScore
property from the contract, since swogh.gg doesn't provide it anymore
- Add
profileAlly(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.
[0.6.0] 2018-08-26
[0.5.11] 2018-07-14
[0.4.10] 2018-06-29
[0.4.9] 2018-05-26
[0.4.8] 2018-05-17
[0.4.7] 2018-04-26
- Cache for Characters (Bossk added)
[0.4.6] 2018-04-12
[0.4.5] 2018-02-10
- Improved retrieving mods performance
[0.4.4] 2018-02-10
- Added lastUpdatedUTC to profile #5
[0.4.2] 2018-02-08
[0.4.1] 2018-01-07
- Cache for Characters & Ship stats
- Added Jest Tests
[0.3.2] 2017-12-02
[0.3.1] 2017-09-28
[0.2.1] 2017-09-22
[0.1.3] 2017-09-20
- Fix "Profile Data undefined" when not showing AllyCode on Swgoh (#2)
[0.1.2] 2017-09-20
[0.1.1] 2017-08-19
- Fixed issue with stars when getting collection
[0.1.0] 2017-08-19
- First release, support collection (toons), player info and guild info.
License
MIT
Disclaimer
The developer of this application does not have any affiliation with the Capital Games, Disney, Lucasfilm Limited or swgoh.gg.