[CHANGE] Simple cookie rotation post
This commit is contained in:
@@ -202,6 +202,25 @@ public sealed class YouTubeClient : IDisposable
|
||||
return tempDatasyncId;
|
||||
}
|
||||
|
||||
public async Task<Result> 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();
|
||||
|
||||
Reference in New Issue
Block a user