[CHANGE] Working on auth hash

This commit is contained in:
max
2025-09-04 20:32:39 +02:00
parent 431a103fac
commit 92e5bb7f1f
6 changed files with 90 additions and 28 deletions

View File

@@ -10,7 +10,7 @@ public sealed class YouTubeClient : IDisposable
public string? UserAgent { get; set; }
public CookieContainer CookieContainer { get; } = new();
public ClientState? ClientState { get; private set; }
public Cookie? SapisidCookie => CookieContainer.GetAllCookies()["SAPISID"];
public Cookie? SapisidCookie => CookieContainer.GetAllCookies()["SAPISID"] ?? CookieContainer.GetAllCookies()["__Secure-3PAPISID"];
public HttpClient? GetHttpClient() => _httpClient;
private HttpClient? _httpClient;
@@ -35,13 +35,17 @@ public sealed class YouTubeClient : IDisposable
public async Task GetStateAsync()
{
var state = await NetworkService.GetClientStateAsync(this);
if (!state.IsSuccess)
if (ClientState == null || !ClientState.LoggedIn)
{
return;
var state = await NetworkService.GetClientStateAsync(this);
if (!state.IsSuccess)
{
return;
}
ClientState = state.Value;
}
ClientState = state.Value;
var accountInfo = await NetworkService.GetCurrentAccountInfoAsync(this);
}
public void Dispose()