[CHANGE] Rework && adding channel fetching

This commit is contained in:
max
2025-09-06 20:40:46 +02:00
parent d0eca248bb
commit c528ad9bb3
10 changed files with 145 additions and 100 deletions

View File

@@ -1,6 +1,3 @@
using System.Net;
using DotBased.Monads;
using Manager.Data.Entities.LibraryContext;
using Manager.YouTube;
namespace Manager.App.Services.System;
@@ -20,32 +17,4 @@ public class ClientManager : BackgroundService
{
// Clear up
}
public async Task<Result<YouTubeClient>> LoadClient(ClientAccountEntity accountEntity)
{
if (_cancellationToken.IsCancellationRequested)
{
return ResultError.Fail("Service is shutting down.");
}
var container = new CookieContainer();
if (accountEntity.HttpCookies.Count != 0)
{
var cookieColl = new CookieCollection();
foreach (var cookieEntity in accountEntity.HttpCookies)
{
cookieColl.Add(new Cookie(cookieEntity.Name, cookieEntity.Value, cookieEntity.Domain));
}
container.Add(cookieColl);
}
var ytClient = new YouTubeClient();
//ytClient.CookieContainer = container;
ytClient.UserAgent = accountEntity.UserAgent;
await ytClient.BuildClientAsync();
return ytClient;
}
}