Skip to content

Instantly share code, notes, and snippets.

@torikushiii
Last active July 8, 2024 15:03
Show Gist options
  • Save torikushiii/59eff33fc8ea89dbc0b2e7652db9d3fd to your computer and use it in GitHub Desktop.
Save torikushiii/59eff33fc8ea89dbc0b2e7652db9d3fd to your computer and use it in GitHub Desktop.
Getting HoyoLab Cookie Guide

HoyoLab Cookie Extraction Guide

Overview

This guide provides one method to extract cookies from your HoyoLab profile. These cookies can be used for various purposes, such as automating tasks with scripts. Follow the steps carefully to ensure you obtain the required cookies correctly.

Warning

Please login through incognito mode and proceed with the steps below to ensure that you're getting the correct cookies.

Method 1: Using Network Tab

  1. Go to your HoyoLab profile and log in with your Hoyoverse account.

  2. Open the browser console by pressing F12.

  3. Navigate to the Network tab.

    Network Tab

  4. Search for getGameRecordCard in the network requests and click on the result. (If you didn't see anything, refresh the page while keeping the browser console open)

    getGameRecordCard Request

  5. Go to the Headers tab and scroll down to find Request Headers. Copy all the cookie values.

    Request Headers

  6. Rename default.config.js to config.js

  7. Paste the copied cookie into your config.js file, and your cookie value should look like this

{
	id: 2,
	active: true,
	type: "genshin",
	data: [
		{
			cookie: "mi18nLang=xxxx; _MHYUUID=xxxx; HYV_LOGIN_PLATFORM_OPTIONAL_AGREEMENT=xxxx; e_nap_token=xxxx; cookie_token_v2=xxxx; account_mid_v2=xxxx; account_id_v2=xxxx; ltoken_v2=xxxx; ltmid_v2=xxxx; ltuid_v2=xxxx; HYV_LOGIN_PLATFORM_LOAD_TIMEOUT=xxxx; DEVICEFP_SEED_ID=xxxx; DEVICEFP_SEED_TIME=xxxx; DEVICEFP=xxxx; HYV_LOGIN_PLATFORM_TRACKING_MAP=xxxx; HYV_LOGIN_PLATFORM_LIFECYCLE_ID=xxxx",
			redeemCode: false,
			dailiesCheck: true,
			weekliesCheck: true,
			stamina: {
				check: false,
				threshold: 150,
				persistent: false
			},
			expedition: {
				check: false,
				persistent: false
			}
		}
	]
}
  1. Run the script using npm start or node index.js.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment