[CHANGE] Fixed auditing, storing images from account import

This commit is contained in:
max
2025-09-15 00:23:57 +02:00
parent e82736a45f
commit 0056a14f79
16 changed files with 201 additions and 47 deletions

View File

@@ -4,18 +4,30 @@ using Manager.YouTube.Models.Innertube;
namespace Manager.YouTube.Parsers.Json;
/// <summary>
/// Parsing functionality for the response from the innertube browse endpoint.
/// </summary>
public static class ChannelJsonParser
{
public static Result<Channel> ParseJsonToChannelData(string json)
{
try
{
var channel = new Channel();
var doc = JsonDocument.Parse(json);
var rootDoc = doc.RootElement;
var channelMetadata = rootDoc
.GetProperty("metadata")
.GetProperty("channelMetadataRenderer");
var channelId = channelMetadata.GetProperty("externalId").GetString();
if (channelId == null)
{
throw new InvalidOperationException("No channel id found.");
}
var channel = new Channel
{
Id = channelId,
ChannelName = channelMetadata.GetProperty("title").ToString(),
};
var microformat = rootDoc.GetProperty("microformat").GetProperty("microformatDataRenderer");
@@ -29,11 +41,6 @@ public static class ChannelJsonParser
channel.Unlisted = microformat.GetProperty("unlisted").GetBoolean();
channel.FamilySafe = microformat.GetProperty("familySafe").GetBoolean();
var channelMetadata = rootDoc
.GetProperty("metadata")
.GetProperty("channelMetadataRenderer");
channel.ChannelName = channelMetadata.GetProperty("title").GetString();
var avatarThumbnails = channelMetadata.GetProperty("avatar")
.GetProperty("thumbnails")
.EnumerateArray();