HoYoLab API - TypeScript/JavaScript HoYoLab API
Its unofficial HoYoLab API Wrapper for getting hoyoverse some in-game data, including Genshin Impact, Honkai Impact 3rd.
Install
For NPM
npm install @vermaysha/hoyolab-api
For Yarn
yarn install @vermaysha/hoyolab-api
Genshin Impact Example
import { GenshinImpact } from '@vermaysha/hoyolab-api'
const client = new GenshinImpact({
cookie: 'YOUR COOKIE',
uid: 'YOUR UID',
})
;(async () => {
const character = await client.getCharacters()
console.log(character)
for more example you can view here Examples
How to obtain HoYoLab Cookie
- To begin, login with your HoYoLab Account.
- Type
java
in the address bar followed by the script down below. -
script:check = document.cookie.includes('ltoken') && document.cookie.includes('ltuid') || alert('Please logout and log back in before trying again, cookie is currently expired/invalid!'); cookie = document.cookie; check && document.write(`<p>${cookie}</p><br><button onclick="navigator.clipboard.writeText('${cookie}')">Click here to copy!</button><br>`)
- Once you've successfully ran the script, click the Click here to copy! button to copy the cookie.
- Finally, you can copy your cookie