Giter VIP home page Giter VIP logo

hoyolab-autosign's Introduction


Hoyolab-Auto-SignIn


繁體中文 English Русский

A lightweight, secure, and free script that automatically collect HoYoLAB daily check in rewards.
Supports Genshin Impact, Honkai Impact 3rd, and Honkai: Star Rail. Support multiple accounts.

Features

  • Lightweight - The script only requires minimal configuration and it's only around 110 lines of code.
  • Secure - The script can be self-deployed to Google Apps Script, no worries about data leaks.
  • Free - Google Apps Script is currently a free service.
  • Simple - The script can run without a browser and will automatically notify you through Discord or Telegram.

Setup

  1. Go to Google Apps Script and create a new project with your custom name.

  2. Select the editor and paste the code( Discord version / Telegram version / Experimental ). Refer to the instructions below to configure the config file and save it.

  3. Select "main" and click the "Run" button at the top.

    image

  4. Grant the necessary permissions and confirm that the configuration is correct (Execution started > completed).

  5. Click the Trigger button on the left side / left tab and add a new trigger on Add Trigger button at bottom right.
    Select the function to run: main
    Select the event source: Time-driven
    Select the type of time based trigger: Day timer
    Select the time of day: recommended to choose any off-peak time between 09:00 to 15:00 or 09:00 AM to 03:00 PM.

Configuration

const profiles = [
  {
    token: "account_mid_v2=1l9XXXXXXXXXX; account_id_v2=28XXXXXXX; ltoken_v2=v2_CANARIAXXXXXXXXXXXXXXX; ltmid_v2=1lXXXXXXX_XX; ltuid_v2=28XXXXXX;",
    genshin: true,
    honkai_star_rail: true,
    honkai_3: true,
    accountName: "YOUR NAME"
  }
];

HoYoLAB has changed the rules for tokens on July 2023, switching from the previous "ltoken" and "ltuid" to "ltoken_v2" and "ltuid_v2".

Important

HoYoLAB has changed the cookie to HttpOnly cookie. It is no longer possible to read the cookies by using the getToken.js code.
Please use the method of manually copying the cookie to obtain the account_mid_v2, account_id_v2, ltoken_v2, ltmid_v2, and ltuid_v2.

HoYoLAB cookie settings

Follow this Intruction to get tokens

  1. Go to HoYoLAB (https://www.hoyolab.com/) and log in.

  2. Go to your profile page.

  3. Open the developer tools (F12 or Ctrl+Shift+I). 4, Go to the "Network" tab.

  4. Click on the "Preserve Log" / "Persist Logs" button.

    image

  5. Refresh the page.

  6. Click on the getGameRecordCard request where the method is "GET" (it should be named "getGameRecordCard" with your HoYoLab UID).

    image

  7. Go to the "Cookies" tab.

  8. Copy the "account_mid_v2", "account_id_v2", "ltoken_v2", "ltmid_v2", and "ltuid_v2" image

Discord notification settings (only for Discord version)
const discord_notify = true
const myDiscordID = "20000080000000040"
const discordWebhook = "https://discord.com/api/webhooks/1050000000000000060/6aXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXnB"
  1. discord_notify

    Whether to enable Discord notify.
    If you want to enable auto check-in notify, set it to true. If not, please set it to false.

  2. myDiscordID - Please enter your Discord user ID.

    Whether you want to be ping when there is an unsuccessful check-in.
    Copy your Discord user ID which like 23456789012345678 and fill it in "quotes".
    You can refer to this article to find your Discord user ID.
    If you don't want to be pinged, leave the "quotes" empty.

  3. discordWebhook - Please enter the Discord webhook for the server channel to send notify.

    You can refer to this article to create a Discord webhook.
    Once you have finished creating the Discord webhook, you will receive your Discord webhook URL, which like https://discord.com/api/webhooks/1234567890987654321/PekopekoPekopekoPekopeko06f810494a4dbf07b726924a5f60659f09edcaa1.
    Copy the webhook URL and paste it in "quotes".

Telegram notification settings (only for Telegram version)
const telegram_notify = true
const myTelegramID = "1XXXXXXX0"
const telegramBotToken = "6XXXXXXXXX:AAAAAAAAAAXXXXXXXXXX8888888888Peko"
  1. telegram_notify

    Whether to enable Telegram notify.
    If you want to enable auto check in notify, set it to true. If not, please set it to false.

  2. myTelegramID - Please enter your Telegram ID.

    Use the /getid command to find your Telegram user ID by messaging @IDBot.
    Copy your Telegram ID which like 123456780 and fill it in "quotes".

  3. telegramBotToken - Please enter your Telegram Bot Token.

    Use the /newbot command to create a new bot on Telegram by messaging @BotFather.
    Once you have finished creating the bot, you will receive your Telegram Bot Token, which like 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw.
    Copy your Telegram Bot Token and fill it in "quotes".
    For more detailed instructions, you can refer to this article.

Demo

If the auto check in process is success, it will send "OK".
If you have already check in today, it will send "Traveler/Trailblazer/Captain, you've already checked in today"

Single HoYoLAB account auto check-in with Discord notification and ping. Enable Genshin Impact and Honkai: Star Rail auto check in, enable Discord notify, ping in Discord.
/** Example **/
const profiles = [
  { token: "account_mid_v2=123xyzabcd_hi; account_id_v2=26XXXXX20; ltoken_v2=v2_CANARIAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX3406; ltmid_v2=123xyzabcd_hi; ltuid_v2=26XXXXX20;", 
    genshin: true, 
    honkai_star_rail: true, 
    honkai_3: false, 
    accountName: "HuTao" }
];

const discord_notify = true
const myDiscordID = "240000800000300040"
const discordWebhook = "https://discord.com/api/webhooks/10xxxxxxxxxxxxxxx60/6aXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXnB"

image

Two HoYoLAB accounts auto check-in with Telegram notification. Enable Genshin Impact auto check-in on accountA, Honkai Impact 3rd auto check-in on accountB, enable Telegram notify.
/** Example **/
const profiles = [
  { token: "account_mid_v2=123xyzabcd_hi; account_id_v2=26XXXXX20; ltoken_v2=v2_CANARIAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX3406; ltmid_v2=123xyzabcd_hi; ltuid_v2=26XXXXX20;", 
    genshin: true, 
    honkai_star_rail: false, 
    honkai_3: false, 
    accountName: "accountA" },

  { token: "account_mid_v2=456qwertyu_hi; account_id_v2=28XXXXX42; ltoken_v2=v2_GENSHINXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX5566; ltmid_v2=456qwertyu_hi; ltuid_v2=28XXXXX42;", 
    genshin: false, 
    honkai_star_rail: false, 
    honkai_3: true, 
    accountName: "accountB" }
];

const telegram_notify = true
const myTelegramID = "1XXXXXXX0"
const telegramBotToken = "6XXXXXXXXX:AAAAAAAAAAXXXXXXXXXX8888888888Peko"

image

Changelog

  • 2022-12-30: Project launched.
  • 2023-04-27: Added support for Honkai Impact 3rd, and Honkai: Star Rail.
  • 2023-04-27: Added switch for Discord notify.
  • 2023-05-12: Updated get token process (#2).
  • 2023-05-12: Added Telegram notify support (#3).
  • 2023-05-13: Added support for multiple HoYoLAB accounts (#4).
  • 2024-02-02: Improved readability, maintainability and added an experimental version which have discord and telegram notification in 1 code.

hoyolab-autosign's People

Contributors

natsumeaoii avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.