diff --git a/TwitchDownloaderCore/ChatDownloader.cs b/TwitchDownloaderCore/ChatDownloader.cs index 60325fa8..ba8a64af 100644 --- a/TwitchDownloaderCore/ChatDownloader.cs +++ b/TwitchDownloaderCore/ChatDownloader.cs @@ -340,15 +340,15 @@ public async Task DownloadAsync(IProgress progress, Cancellation progress.Report(new ProgressReport() { reportType = ReportType.Status, data = "Downloading + Embedding Images" }); chatRoot.embeddedData = new EmbeddedData(); - List thirdPartyEmotes = new List(); - List firstPartyEmotes = new List(); - List twitchBadges = new List(); - List twitchBits = new List(); + List thirdPartyReturnList = new List(); + List firstPartyReturnList = new List(); + List badgesReturnList = new List(); + List bitsReturnList = new List(); - thirdPartyEmotes = await TwitchHelper.GetThirdPartyEmotes(chatRoot.streamer.id, downloadOptions.TempFolder, bttv: downloadOptions.BttvEmotes, ffz: downloadOptions.FfzEmotes, stv: downloadOptions.StvEmotes); - firstPartyEmotes = await TwitchHelper.GetEmotes(comments, downloadOptions.TempFolder); - twitchBadges = await TwitchHelper.GetChatBadges(chatRoot.streamer.id, downloadOptions.TempFolder); - twitchBits = await TwitchHelper.GetBits(downloadOptions.TempFolder, chatRoot.streamer.id.ToString()); + List thirdPartyEmotes = await TwitchHelper.GetThirdPartyEmotes(chatRoot.streamer.id, downloadOptions.TempFolder, bttv: downloadOptions.BttvEmotes, ffz: downloadOptions.FfzEmotes, stv: downloadOptions.StvEmotes); + List firstPartyEmotes = await TwitchHelper.GetEmotes(comments, downloadOptions.TempFolder); + List twitchBadges = await TwitchHelper.GetChatBadges(chatRoot.streamer.id, downloadOptions.TempFolder); + List twitchBits = await TwitchHelper.GetBits(downloadOptions.TempFolder, chatRoot.streamer.id.ToString()); foreach (TwitchEmote emote in thirdPartyEmotes) { @@ -359,8 +359,10 @@ public async Task DownloadAsync(IProgress progress, Cancellation newEmote.name = emote.Name; newEmote.width = emote.Width / emote.ImageScale; newEmote.height = emote.Height / emote.ImageScale; - chatRoot.embeddedData.thirdParty.Add(newEmote); + thirdPartyReturnList.Add(newEmote); } + chatRoot.embeddedData.thirdParty = thirdPartyReturnList; + thirdPartyReturnList.Clear(); foreach (TwitchEmote emote in firstPartyEmotes) { EmbedEmoteData newEmote = new EmbedEmoteData(); @@ -369,15 +371,19 @@ public async Task DownloadAsync(IProgress progress, Cancellation newEmote.data = emote.ImageData; newEmote.width = emote.Width / emote.ImageScale; newEmote.height = emote.Height / emote.ImageScale; - chatRoot.embeddedData.firstParty.Add(newEmote); + firstPartyReturnList.Add(newEmote); } + chatRoot.embeddedData.firstParty= firstPartyReturnList; + firstPartyReturnList.Clear(); foreach (ChatBadge badge in twitchBadges) { EmbedChatBadge newBadge = new EmbedChatBadge(); newBadge.name = badge.Name; newBadge.versions = badge.VersionsData; - chatRoot.embeddedData.twitchBadges.Add(newBadge); + badgesReturnList.Add(newBadge); } + chatRoot.embeddedData.twitchBadges = badgesReturnList; + badgesReturnList.Clear(); foreach (CheerEmote bit in twitchBits) { EmbedCheerEmote newBit = new EmbedCheerEmote(); @@ -394,8 +400,10 @@ public async Task DownloadAsync(IProgress progress, Cancellation newEmote.height = emotePair.Value.Height / emotePair.Value.ImageScale; newBit.tierList.Add(emotePair.Key, newEmote); } - chatRoot.embeddedData.twitchBits.Add(newBit); + bitsReturnList.Add(newBit); } + chatRoot.embeddedData.twitchBits = bitsReturnList; + bitsReturnList.Clear(); } switch (downloadOptions.DownloadFormat) diff --git a/TwitchDownloaderCore/TwitchHelper.cs b/TwitchDownloaderCore/TwitchHelper.cs index a26dddea..07d18b76 100644 --- a/TwitchDownloaderCore/TwitchHelper.cs +++ b/TwitchDownloaderCore/TwitchHelper.cs @@ -243,7 +243,7 @@ public static async Task> GetThirdPartyEmotes(int streamerId, returnList.Add(newEmote); alreadyAdded.Add(emoteData.name); } - catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { } + catch { } } }