Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat downloads fail (emoticon id is null) #1254

Closed
2 tasks done
AdmiralCurtiss opened this issue Nov 14, 2024 · 0 comments · Fixed by #1255
Closed
2 tasks done

Chat downloads fail (emoticon id is null) #1254

AdmiralCurtiss opened this issue Nov 14, 2024 · 0 comments · Fixed by #1255
Labels
bug Something isn't working

Comments

@AdmiralCurtiss
Copy link
Contributor

Checklist

Edition

Command Line Interface

Describe your issue here

Command line arguments:

chatdownload -E --chat-connections 1 --id 2300936847 -o test.json

Output with somewhat useless stack trace:

[WARNING] --chat-connections has been deprecated in favor of -t / --threads and may be removed. Run 'TwitchDownloaderCLI.exe help' for more information.
TwitchDownloaderCLI 1.55.0 Copyright (c) lay295 and contributors
[STATUS] - Downloading 100%
[STATUS] - Downloading Embed Images 25%Unhandled exception. System.AggregateException: One or more errors occurred. (A task was canceled.)
 ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at TwitchDownloaderCLI.Modes.DownloadChat.Download(ChatDownloadArgs inputOptions) in TwitchDownloader\TwitchDownloaderCLI\Modes\DownloadChat.cs:line 23
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at TwitchDownloaderCLI.Program.Main(String[] args) in TwitchDownloader\TwitchDownloaderCLI\Program.cs:line 34
--- End of stack trace from previous location ---

   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at TwitchDownloaderCLI.Modes.DownloadChat.Download(ChatDownloadArgs inputOptions) in TwitchDownloader\TwitchDownloaderCLI\Modes\DownloadChat.cs:line 23
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at TwitchDownloaderCLI.Program.Main(String[] args) in TwitchDownloader\TwitchDownloaderCLI\Program.cs:line 34

TwitchDownloader\TwitchDownloaderCLI\bin\Release\net6.0\TwitchDownloaderCLI.exe (process 8564) exited with code 0.

Actual stack:

[Async] Task (System.Net.Http.HttpConnection) [Promise]
[Async] System.Threading.Tasks.TaskCompletionSourceWithCancellation<System.Net.Http.HttpConnection>.WaitWithCancellationAsync(System.Threading.CancellationToken)
[Async] System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(System.Net.Http.HttpRequestMessage, bool, System.Threading.CancellationToken)
[Async] System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(System.Net.Http.HttpRequestMessage, bool, bool, System.Threading.CancellationToken)
[Async] System.Net.Http.RedirectHandler.SendAsync(System.Net.Http.HttpRequestMessage, bool, System.Threading.CancellationToken)
[Async] System.Net.Http.HttpClient.GetByteArrayAsyncCore(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
[Async] TwitchDownloaderCore.TwitchHelper.GetImage(System.IO.DirectoryInfo, string, string, int, string, TwitchDownloaderCore.Interfaces.ITaskLogger, System.Threading.CancellationToken)
[Async] TwitchDownloaderCore.TwitchHelper.GetEmotes(System.Collections.Generic.List<TwitchDownloaderCore.TwitchObjects.Comment>, string, TwitchDownloaderCore.Interfaces.ITaskLogger, TwitchDownloaderCore.TwitchObjects.EmbeddedData, bool, System.Threading.CancellationToken)
[Async] TwitchDownloaderCore.ChatDownloader.EmbedImages(TwitchDownloaderCore.TwitchObjects.ChatRoot, System.Threading.CancellationToken)
[Async] TwitchDownloaderCore.ChatDownloader.DownloadAsyncImpl(System.IO.FileInfo, System.IO.FileStream, System.Threading.CancellationToken)
[Async] TwitchDownloaderCore.ChatDownloader.DownloadAsync(System.Threading.CancellationToken)
TwitchDownloaderCLI.Modes.DownloadChat.Download(TwitchDownloaderCLI.Modes.Arguments.ChatDownloadArgs)
CommandLine.ParserResultExtensions.WithParsed<TwitchDownloaderCLI.Modes.Arguments.ChatDownloadArgs>(CommandLine.ParserResult<object>, System.Action<TwitchDownloaderCLI.Modes.Arguments.ChatDownloadArgs>)
TwitchDownloaderCLI.Program.Main(string[])

I've debugged this a little bit and the cause seems to stem from this loop here:

foreach (var id in comment.message.fragments
.Select(f => f.emoticon?.emoticon_id)
.Where(id => !alreadyAdded.Contains(id) && !failedEmotes.Contains(id)))
{
try
{
byte[] bytes = await GetImage(emoteFolder, $"https://static-cdn.jtvnw.net/emoticons/v2/{id}/default/dark/2.0", id, 2, "png", logger, cancellationToken);
TwitchEmote newEmote = new TwitchEmote(bytes, EmoteProvider.FirstParty, 2, id, id);
alreadyAdded.Add(id);
returnList.Add(newEmote);

The loop variable ends up being null at some point, which causes the call to GetImage() to be invoked with an url of https://static-cdn.jtvnw.net/emoticons/v2//default/dark/2.0, which obviously fails to produce anything useful.

It's unclear to me whether this is just missing a null check (if so, how was this never noticed before?) or whether there's an underlying issue here that I'm not seeing due to lack of familiarity with this code.

Add any related files or extra information here

No response

@AdmiralCurtiss AdmiralCurtiss added the bug Something isn't working label Nov 14, 2024
@AdmiralCurtiss AdmiralCurtiss changed the title Chat downloads fail (emoticon_id is null) Chat downloads fail (emoticon id is null) Nov 14, 2024
AdmiralCurtiss added a commit to AdmiralCurtiss/TwitchDownloader that referenced this issue Nov 14, 2024
AdmiralCurtiss added a commit to AdmiralCurtiss/TwitchDownloader that referenced this issue Nov 14, 2024
@ScrubN ScrubN closed this as completed Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants