From 88e724099caa819e2c8001a56c09d08bc70a3ab6 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 22 Sep 2025 00:51:42 +0200 Subject: [PATCH] [CHANGE] Simple cookie rotation post --- Manager.YouTube/YouTubeClient.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Manager.YouTube/YouTubeClient.cs b/Manager.YouTube/YouTubeClient.cs index e16f28a..25ca253 100644 --- a/Manager.YouTube/YouTubeClient.cs +++ b/Manager.YouTube/YouTubeClient.cs @@ -202,6 +202,25 @@ public sealed class YouTubeClient : IDisposable return tempDatasyncId; } + public async Task RotateCookiesAsync() + { + if (IsAnonymous) + { + return ResultError.Fail("Anonymous clients cannot rotate cookies!"); + } + + try + { + var rotateRequest = new HttpRequestMessage(HttpMethod.Post, new Uri("https://accounts.youtube.com/RotateCookies")); + var response = await HttpClient.SendAsync(rotateRequest); + return !response.IsSuccessStatusCode ? ResultError.Fail($"Cookies rotation failed, status code: {response.StatusCode}") : Result.Success(); + } + catch (Exception e) + { + return ResultError.Error(e); + } + } + public void Dispose() { HttpClient.Dispose();