[REWORK] Changes saving client and channel info

This commit is contained in:
max
2025-09-18 02:01:45 +02:00
parent 9e173258ed
commit 5250b9f3f9
10 changed files with 201 additions and 153 deletions

View File

@@ -1,6 +1,6 @@
namespace Manager.YouTube.Models.Innertube;
public class Channel
public class InnertubeChannel
{
public required string Id { get; set; }
public bool NoIndex { get; set; }

View File

@@ -6,7 +6,7 @@ namespace Manager.YouTube.Parsers.Json;
public static class ChannelJsonParser
{
public static Result<Channel> ParseJsonToChannelData(string json)
public static Result<InnertubeChannel> ParseJsonToChannelData(string json)
{
try
{
@@ -23,7 +23,7 @@ public static class ChannelJsonParser
throw new InvalidOperationException("No channel id found.");
}
var channel = new Channel
var channel = new InnertubeChannel
{
Id = channelId,
ChannelName = channelMetadata.GetProperty("title").ToString(),

View File

@@ -148,7 +148,7 @@ public sealed class YouTubeClient : IDisposable
return Result.Success();
}
public async Task<Result<Channel>> GetChannelByIdAsync(string channelId)
public async Task<Result<InnertubeChannel>> GetChannelByIdAsync(string channelId)
{
if (State == null)
{

View File

@@ -0,0 +1,11 @@
using System.Collections.ObjectModel;
namespace Manager.YouTube;
public class YouTubeClientCollection : KeyedCollection<string, YouTubeClient>
{
protected override string GetKeyForItem(YouTubeClient item)
{
return item.Id;
}
}