Genshin Automation
This tool will automatically collect Hoyolab daily login rewards.
Using this tool you can:
- Automate your rewards on the Hoyolab website.
- Export your gacha wish history of your account to an Excel file and upload it to Dropbox.
How to use this tool?
Fork this repository and you can move on to the next step.
Automatic collection of Hoyolab rewards for daily login
1) Receiving Your Account Cookies
Instruction
- I'm using Chrome browser, if you're using a different browser, some names may vary.
- Open the siteScript.js file and copy its contents.
var cookie=start(); var ask=confirm('Cookie: '+cookie+'\n\nClick confirm to copy Cookie.');if(ask==true){copy(cookie);msg=cookie}else{msg='Cancel'} function start() { return "ltoken=" + getCookie("ltoken") + ";ltuid=" + getCookie("ltuid") + ";"; function getCookie(name) { const value = ";" + document.cookie; const parts = value.split("; " + name + "="); if (parts.length === 2) return parts.pop().split(';').shift(); } }
- Go to https://www.hoyolab.com/genshin/ then login.
- Right-click on the page and click on View Code, then click on the Console tab.
- Paste the code you copied in the second paragraph and press Enter.
- In the window that appears, click Ok and the necessary Cookies will be automatically copied to your clipboard.
2) Set up variables in GitHub
Instruction
- Let's add Cookies to the variable, for this go to the following path in the cloned repository Settings -> Secrets -> Actions -> New repository secret
- Enter a variable name and Cookies depending on what you want to set up your repository for. In the first field you need to specify the name of the variable, in the second field Cookies. See examples below.
Example for one account
- Variable name:
HOYOLAB_COOKIE
, Cookies example:ltoken=t**************************************Q;ltuid=8******4;
In this case, you just need to paste the text received in theGetting Your Account Cookies
section.
Please note, it is important to write Cookies on one line
Example for multiple accounts
- Variable name:
HOYOLAB_COOKIES
, Cookies example:["ltoken=a**************************************B;ltuid=1******2;","ltoken=c**************************************D;ltuid=3******4;","ltoken=e**************************************F;ltuid=5******6;"]
In this case, you need to open square brackets[
list received in the sectionGetting your account's Cookies
, Cookies must be in double quotes"
, separated by commas and then close square brackets]
.
Please note, it is important to write Cookies on one line
Confirm variable creation
- Click the Add secret button to add a variable.
3) Adding GitHub Actions
Instruction
Create an action that will be executed daily at 06:00 (UTC+8) Actions -> Hoyolab Automation -> Run workflow -> Run workflow
After that rewards will be collected automatically (sometimes Cookies need to be updated)
Export wish history
1) Get a link with wish history
PC Instruction
- Open Genshin Impact in this PC (If you use multiple accounts, please restart the game)
- Then open the wish history in the game and wait it to load
- Press START on your keyboard, then search for Powershell
- Click Windows Powershell, then copy & paste the script below to the Powershell
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Sergiy3013/genshin_automation/master/getlink_global.ps1'))
- Press ENTER, and a link will copied to your clipboard.
Android Instruction
- Open Wish (in the game)
- Press History
- Wait for it to load
- Turn off your Wi-Fi and data connection
- Press refresh on top right corner
- The page should display an error and show you some text with a black font
- Hold the text and press select all, then copy that text (don't copy only some portion of the text)
- Turn on your Wi-Fi or data connection
2) Create your own Dropbox app
Instruction
- Follow this link: https://www.dropbox.com/lp/developers
- Click the
Create apps
button - Select everything as in the screenshot below and enter the name of your application in the
Name your app
- Switch to the
Permissions
tab, selectfiles.content.write
and clickSubmit
- Switch to the
Settings
tab, in the fieldRedirect URIs
(it's underOAuth 2
) enterhttp://localhost/
and clickAdd
. - Click the
Generate
button (screenshot 1) and copy the resulting code (screenshot 2) Click on it with the left mouse button to select all the code and copy it
3) Set up variables in GitHub
Instruction
- Go to the following path in your repository Settings -> Secrets -> Actions -> New repository secret
- Enter the variable name (arrow 1) and desired data (arrow 2).
- Add a variable named
AUTHKEY_URL
and the value you got in theGet a link with wish history
paragraph - Add a variable named
DROPBOX_TOKEN
and the value you got in theCreate your own Dropbox app
paragraph
- Add a variable named