HoYoLab_API 1.0.1-hotfix

This is a prerelease version of HoYoLab_API.
There is a newer version of this package available.
See the version list below for details.
dotnet add package HoYoLab_API --version 1.0.1-hotfix                
NuGet\Install-Package HoYoLab_API -Version 1.0.1-hotfix                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HoYoLab_API" Version="1.0.1-hotfix" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HoYoLab_API --version 1.0.1-hotfix                
#r "nuget: HoYoLab_API, 1.0.1-hotfix"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HoYoLab_API as a Cake Addin
#addin nuget:?package=HoYoLab_API&version=1.0.1-hotfix&prerelease

// Install HoYoLab_API as a Cake Tool
#tool nuget:?package=HoYoLab_API&version=1.0.1-hotfix&prerelease                

HoYoLab-API

A small API for working with HoYoLab. Primarily developed for daily rewards in Genshin Impact

Usage:

Getting HoYoLab account cookies

To use the API, you will need HoYoLab cookies. To get them, go to www.hoyolab.com, authorize and press F12 → Console → Enter this in text field:

copy(document.cookie);

Done! Cookies copied in your clipboard.

<img src="preview-cookies.jpg" alt="Copy cookie preview"/>

Creating a new HoYoLab Account instance

To create a new account instance, you need to have cookies string (formatted like a example below).

using HoYoLab_API;

public void SomeMethod()
{
    var account = new HoyolabAccount(
                rawCookies: "ltoken=12AOxlS0gnNGqQ2kOgJR2C2g28S1uU6dgBT0qgKa; ltuid=52606212", language: "en-us", userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0");
}

Supported account languages:

Language Code
English en-us
Pусский ru-ru
日本語 ja-jp
한국어 ko-kr
Deutsch de-de
Español es-es
Français fr-fr
Indonesia id-id
Português pt-pt
ภาษาไทย th-th
Tiếng Việt vi-vn
简体中文 zh-cn
繁體中文 zh-tw

How to check is the authentication in HoYoLab success:

if (account.IsValid)
{
    <...>
}

Examples:

Console.WriteLine(string.Join(", ", account.GameAccounts));
Console.WriteLine(account.DailyCheckIn.CurrentMonthlyRewards);
Console.WriteLine(account.DailyCheckIn.CurrentRewardInformation);
Console.WriteLine(account.DailyCheckIn.ClaimReward());

Preview: <img src="https://github.com/No738/HoYoLab-API/blob/master/preview-examples.png" alt="Using examples preview"/>

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 447 5/27/2022
1.0.1-hotfix 160 5/28/2022