[CHANGE] Rework && adding channel fetching
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user