[CHANGE] Fixed auditing, storing images from account import
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user