diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SearchResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SearchResources.resw index a9da29a..093321f 100644 --- a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SearchResources.resw +++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SearchResources.resw @@ -129,12 +129,18 @@ Invalid url. Twitch channel not found. + + Invalid url. Twitch clip not found. + Twitch authentication error. Not authenticated to Twitch. Twitch authentication error. Authentication token is invalid. + + Invalid url. Twitch VOD not found. + Invalid url. Url does not match any of supported source's media types. diff --git a/VDownload.Sources/VDownload.Sources.Twitch/VDownload.Sources.Twitch/TwitchSearchService.cs b/VDownload.Sources/VDownload.Sources.Twitch/VDownload.Sources.Twitch/TwitchSearchService.cs index 1604915..76deef7 100644 --- a/VDownload.Sources/VDownload.Sources.Twitch/VDownload.Sources.Twitch/TwitchSearchService.cs +++ b/VDownload.Sources/VDownload.Sources.Twitch/VDownload.Sources.Twitch/TwitchSearchService.cs @@ -87,6 +87,11 @@ namespace VDownload.Sources.Twitch GetVideosResponse info = await _apiService.HelixGetVideo(id, token); + if (info.Data is null) + { + throw CreateExceptionVodNotFound(); + } + Api.Helix.GetVideos.Response.Data vodResponse = info.Data[0]; TwitchVod vod = await ParseVod(vodResponse); @@ -100,6 +105,11 @@ namespace VDownload.Sources.Twitch GetClipsResponse info = await _apiService.HelixGetClip(id, token); + if (info.Data.Count == 0) + { + throw CreateExceptionClipNotFound(); + } + Api.Helix.GetClips.Response.Data clipResponse = info.Data[0]; TwitchClip clip = await ParseClip(clipResponse); @@ -306,6 +316,8 @@ namespace VDownload.Sources.Twitch protected MediaSearchException CreateExceptionNotAuthenticated() => new MediaSearchException("TwitchNotAuthenticated"); protected MediaSearchException CreateExceptionTokenValidationUnsuccessful() => new MediaSearchException("TwitchTokenValidationUnsuccessful"); protected MediaSearchException CreateExceptionChannelNotFound() => new MediaSearchException("TwitchChannelNotFound"); + protected MediaSearchException CreateExceptionVodNotFound() => new MediaSearchException("TwitchVodNotFound"); + protected MediaSearchException CreateExceptionClipNotFound() => new MediaSearchException("TwitchClipNotFound"); #endregion }