EN | ES
A package to get data from the enka API, it also includes a finder that you can use to search for names and images of game assets, for example a name or image of a character. Check Finders for more information.
- v1.0.1:
- Changed the request url to prevent getting unnecessary 301s.
- v1.1.1:
- Added 3.0 version content.
- Added gacha images for characters.
- Changed the url of enka CDN.
- v1.2.1:
- Improved data structure for better data management.
- Now empty values will return empty strings, arrays and objects depending on the value type instead of null.
- Fixed some bugs.
- Added profiles API support.
- v1.3.0:
- Fixed Ayaka and Mona talents.
- Added missing proudSkillExtraLevelMap.
- Added support for custom User-Agent on requests.
- Added 3.1 version content.
- v1.3.6
- Added 3.2 version content.
- Now you can access to asset names/images directly from characters, namecards, etc objects.
- v1.3.9:
- Added 3.3 version content + IT and TR Languages
- v1.3.10:
- Reduced file amount of the package.
- v2.0.0:
- Reworked the entire data structure and some package structure.
- Merged
AssetNameFinder
andAssetImageFinder
intoAssetFinder
. - Added an auto updater for the new genshin versions content.
- Added cache system (optional) to reduce the requests sent to Enka API.
- Fixed some bugs and errors.
- Added JSDoc.
- v2.0.1:
- Changed the player request endpoint since
/u/<UID>/__data.json
is now deprecated and will stop existing in 2 days. - Removed the
key
parameter from the Wrapper class since it's no longer needed. - Added profile API route (in case it exists) in the player structure.
- Changed the player request endpoint since
- v2.0.2:
- Fixed when a character's weapon doesn't have refinement throws an error.
- v2.1.0 (Breaking changes from <v2.0.2):
- Implemented the new profile routes and data.
- Changed profile structure, refer to the new structure
- Updated the player structure to add the
owner
field. - Fixed when you search for a weapon name it returns an empty string.
- Fixed errors and bugs.
- v2.1.1:
- Fixed wrong skills order display of characters.
- Added a costume finder to
AssetFinder
. - Added the 3.5 content.
- v2.1.2:
- Fixed when a player had the traveler in the showcase it would throw an error.
- v2.1.3:
- Fixed when trying to use the
character()
method of AssetFinder class would throw an error if the character id was the one of a travelers and their depot skill id. - Fixed when the content updater downloads the files without all the content leading to errors.
- Now it won't be necessary to restart the application when the new content files are downloaded to read the new information.
- If a cache file it's corrupted it will automatically delete it and add a new cache file with fresh data.
- You can now delete the cache folder with
CacheHandler.deleteCacheDirectory()
- Fixed when trying to use the
- v2.1.4:
- Removed the content file reload since it would increase significantly the time to request players data.
const { Wrapper } = require('enkanetwork.js')
const client = new Wrapper(options)
/** options:
* userAgent: string -> optional (default is enkanetwork.js/v<package_version>)
* language: string -> optional (default is English)
* cache: boolean -> optional (default is false)
*/
async function getData(uid) {
const data = await client.getPlayer(uid)
console.log(data)
}
getData(738081787)
const { Wrapper } = require('enkanetwork.js')
const client = new Wrapper({
cache: true
})
async function getDataWithCache(uid) {
const data = await client.getPlayer(uid)
console.log(data)
}
getDataWithCache(738081787)
const { Wrapper } = require('enkanetwork.js')
const client = new Wrapper(options)
/** options:
* userAgent: string -> optional (default is enkanetwork.js/v<package_version>)
* language: string -> optional (default is English)
* cache: boolean -> optional (default is false)
*/
// The language is optional
async function getProfile(username, hash, language) {
const profile = await client.getEnkaProfile(username)
const hoyos = await client.getEnkaHoyos(username, language)
const builds = await client.getEnkaHoyoBuilds(username, hash, language)
}
getUser('algoinde', '4Wjv2e', 'en')
You can check the structure change here
You can find fightPropMap
original properties in fightPropMap Data
const { ContentUpdater } = require('enkanetwork.js')
const updater = new ContentUpdater(options)
/** options:
* checkInterval: number -> optional (default is 20000 ms (20 seconds))
*/
updater.on('onUpdateSuccess', () => {
console.log('The content files were successfully updated!')
})
updater.on('onUpdateFail', (errorMessage) => {
console.log(errorMessage)
})
updater.checkForUpdates()
The finder can only find names and images of the assets provided in the enka API, for example it won't find the name of a quest name even if you have the hash of the name.
const { AssetFinder } = require('enkanetwork.js')
const finder = new AssetFinder(options)
/** options:
* language: string -> optional.
* English is the default language.
* All in-game languages supported.
*/
function getCharacter(characterId) {
const assets = finder.character(characterId).assets
const name = finder.character(characterId).name
console.log(assets, name) // Output: Hu Tao assets and name.
}
function getNameByHash(nameTextMapHash) {
const name = finder.hash(nameTextMapHash).value
console.log(name) // Output: Hu Tao (depends on the language)
}
getAssetName(10000046) // Hu Tao ID.
getNameByHash(1940919994) // Hu Tao name hash.
You can get the images of characters, constellations, skills, weapons, costumes and namecards too.
You can get the image with the following URL: https://enka.network/ui/[ICON_NAME].png
, however you can get it directly with this code:
function getAssetImageLink(imageName) {
const url = finder.toLink(imagineName)
console.log(url) // Output: https://enka.network/ui/UI_AvatarIcon_Hutao.png
}
getAssetImageLink("UI_AvatarIcon_Hutao")
Creator: Jelosus1 If you need support you can contact me on discord: Jelosus1#7864. Join the discord server of enka. You can ping me there for support too.