From 17868d9708cf2dfcb0d3cb907643028ad9cfd353 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Thu, 24 Feb 2022 15:35:38 -0600 Subject: [PATCH] fixed some bugs --- Program.cs | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/Program.cs b/Program.cs index 828cd00..026061a 100644 --- a/Program.cs +++ b/Program.cs @@ -472,23 +472,27 @@ namespace TYTD StringBuilder builder = new StringBuilder(); foreach (var v in plitem.Videos) { + try + { + var item = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine("Info", $"{v}.json"))); + Dictionary videos = new Dictionary(); + videos.AddEscapedHtml("Title", item.Title); + videos.AddEscapedHtml("Id", item.Id); + videos.AddEscapedHtml("AuthorTitle", item.AuthorTitle); + videos.AddEscapedHtml("AuthorChannelId", item.AuthorChannelId); + videos.AddEscapedHtml("DurationStringLong", TimeSpan.FromSeconds(item.Duration).ToString()); + videos.AddEscapedHtml("DurationNumber", item.Duration.ToString()); + videos.AddEscapedHtml("Likes", item.Likes.ToString()); + videos.AddEscapedHtml("Dislikes", item.Dislikes.ToString()); + videos.AddEscapedHtml("Views", item.Views.ToString()); - var item = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine("Info", $"{v}.json"))); - Dictionary videos = new Dictionary(); - videos.AddEscapedHtml("Title", item.Title); - videos.AddEscapedHtml("Id", item.Id); - videos.AddEscapedHtml("AuthorTitle", item.AuthorTitle); - videos.AddEscapedHtml("AuthorChannelId", item.AuthorChannelId); - videos.AddEscapedHtml("DurationStringLong", TimeSpan.FromSeconds(item.Duration).ToString()); - videos.AddEscapedHtml("DurationNumber", item.Duration.ToString()); - videos.AddEscapedHtml("Likes", item.Likes.ToString()); - videos.AddEscapedHtml("Dislikes", item.Dislikes.ToString()); - videos.AddEscapedHtml("Views", item.Views.ToString()); - - videos.AddEscapedHtml("Description", item.Description); - videos.AddEscapedHtml("UploadDate", DateTime.Parse(item.UploadDate).ToShortDateString()); - builder.Append(Templating.RenderString(htmlBeforeProcessed, videos)); - + videos.AddEscapedHtml("Description", item.Description); + videos.AddEscapedHtml("UploadDate", DateTime.Parse(item.UploadDate).ToShortDateString()); + builder.Append(Templating.RenderString(htmlBeforeProcessed, videos)); + }catch(Exception ex) + { + _ = ex; + } } Dictionary playlist = new Dictionary();