diff --git a/TwitchDownloaderCLI/Modes/DownloadVideo.cs b/TwitchDownloaderCLI/Modes/DownloadVideo.cs index d30b4cce..9a9bc596 100644 --- a/TwitchDownloaderCLI/Modes/DownloadVideo.cs +++ b/TwitchDownloaderCLI/Modes/DownloadVideo.cs @@ -54,7 +54,7 @@ private static VideoDownloadOptions GetDownloadOptions(VideoDownloadArgs inputOp { DownloadThreads = inputOptions.DownloadThreads, ThrottleKib = inputOptions.ThrottleKib, - Id = int.Parse(vodIdMatch.ValueSpan), + Id = long.Parse(vodIdMatch.ValueSpan), Oauth = inputOptions.Oauth, Filename = inputOptions.OutputFile, Quality = Path.GetExtension(inputOptions.OutputFile)!.ToLower() switch diff --git a/TwitchDownloaderCore/ChatDownloader.cs b/TwitchDownloaderCore/ChatDownloader.cs index 33b9f321..d2cffeb4 100644 --- a/TwitchDownloaderCore/ChatDownloader.cs +++ b/TwitchDownloaderCore/ChatDownloader.cs @@ -274,7 +274,7 @@ public async Task DownloadAsync(CancellationToken cancellationToken) if (downloadType == DownloadType.Video) { - GqlVideoResponse videoInfoResponse = await TwitchHelper.GetVideoInfo(int.Parse(videoId)); + GqlVideoResponse videoInfoResponse = await TwitchHelper.GetVideoInfo(long.Parse(videoId)); if (videoInfoResponse.data.video == null) { throw new NullReferenceException("Invalid VOD, deleted/expired VOD possibly?"); @@ -291,7 +291,7 @@ public async Task DownloadAsync(CancellationToken cancellationToken) viewCount = videoInfoResponse.data.video.viewCount; game = videoInfoResponse.data.video.game?.displayName ?? "Unknown"; - GqlVideoChapterResponse videoChapterResponse = await TwitchHelper.GetOrGenerateVideoChapters(int.Parse(videoId), videoInfoResponse.data.video); + GqlVideoChapterResponse videoChapterResponse = await TwitchHelper.GetOrGenerateVideoChapters(long.Parse(videoId), videoInfoResponse.data.video); chatRoot.video.chapters.EnsureCapacity(videoChapterResponse.data.video.moments.edges.Count); foreach (var responseChapter in videoChapterResponse.data.video.moments.edges) { diff --git a/TwitchDownloaderCore/ChatUpdater.cs b/TwitchDownloaderCore/ChatUpdater.cs index e8096f0b..8e99366b 100644 --- a/TwitchDownloaderCore/ChatUpdater.cs +++ b/TwitchDownloaderCore/ChatUpdater.cs @@ -97,7 +97,7 @@ private async Task UpdateVideoInfo(int totalSteps, int currentStep, Cancellation if (chatRoot.video.id.All(char.IsDigit)) { - var videoId = int.Parse(chatRoot.video.id); + var videoId = long.Parse(chatRoot.video.id); VideoInfo videoInfo = null; try { diff --git a/TwitchDownloaderCore/Options/VideoDownloadOptions.cs b/TwitchDownloaderCore/Options/VideoDownloadOptions.cs index 20d5d062..19151a58 100644 --- a/TwitchDownloaderCore/Options/VideoDownloadOptions.cs +++ b/TwitchDownloaderCore/Options/VideoDownloadOptions.cs @@ -5,7 +5,7 @@ namespace TwitchDownloaderCore.Options { public class VideoDownloadOptions { - public int Id { get; set; } + public long Id { get; set; } public string Quality { get; set; } public string Filename { get; set; } public bool TrimBeginning { get; set; } diff --git a/TwitchDownloaderCore/TwitchHelper.cs b/TwitchDownloaderCore/TwitchHelper.cs index 04fcf7c3..03dbbf81 100644 --- a/TwitchDownloaderCore/TwitchHelper.cs +++ b/TwitchDownloaderCore/TwitchHelper.cs @@ -27,7 +27,7 @@ public static class TwitchHelper private static readonly HttpClient httpClient = new HttpClient(); private static readonly string[] BttvZeroWidth = { "SoSnowy", "IceCold", "SantaHat", "TopHat", "ReinDeer", "CandyCane", "cvMask", "cvHazmat" }; - public static async Task GetVideoInfo(int videoId) + public static async Task GetVideoInfo(long videoId) { var request = new HttpRequestMessage() { @@ -41,7 +41,7 @@ public static async Task GetVideoInfo(int videoId) return await response.Content.ReadFromJsonAsync(); } - public static async Task GetVideoToken(int videoId, string authToken) + public static async Task GetVideoToken(long videoId, string authToken) { var request = new HttpRequestMessage() { @@ -57,7 +57,7 @@ public static async Task GetVideoToken(int videoId, strin return await response.Content.ReadFromJsonAsync(); } - public static async Task GetVideoPlaylist(int videoId, string token, string sig) + public static async Task GetVideoPlaylist(long videoId, string token, string sig) { HttpRequestMessage request; HttpResponseMessage response; @@ -1032,7 +1032,7 @@ public static async Task GetUserInfo(List idList) } /// When a given video has only 1 chapter, data.video.moments.edges will be empty. - public static async Task GetVideoChapters(int videoId) + public static async Task GetVideoChapters(long videoId) { var request = new HttpRequestMessage() { @@ -1056,7 +1056,7 @@ public static async Task GetVideoChapters(int videoId) return chapterResponse; } - public static async Task GetOrGenerateVideoChapters(int videoId, VideoInfo videoInfo) + public static async Task GetOrGenerateVideoChapters(long videoId, VideoInfo videoInfo) { var chapterResponse = await GetVideoChapters(videoId); diff --git a/TwitchDownloaderWPF/PageChatDownload.xaml.cs b/TwitchDownloaderWPF/PageChatDownload.xaml.cs index d03c3cf1..54482840 100644 --- a/TwitchDownloaderWPF/PageChatDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageChatDownload.xaml.cs @@ -115,7 +115,7 @@ private async Task GetVideoInfo() { if (downloadType == DownloadType.Video) { - GqlVideoResponse videoInfo = await TwitchHelper.GetVideoInfo(int.Parse(downloadId)); + GqlVideoResponse videoInfo = await TwitchHelper.GetVideoInfo(long.Parse(downloadId)); var thumbUrl = videoInfo.data.video.thumbnailURLs.FirstOrDefault(); if (!ThumbnailService.TryGetThumb(thumbUrl, out var image)) diff --git a/TwitchDownloaderWPF/PageChatUpdate.xaml.cs b/TwitchDownloaderWPF/PageChatUpdate.xaml.cs index f47b5b78..e8aa8566 100644 --- a/TwitchDownloaderWPF/PageChatUpdate.xaml.cs +++ b/TwitchDownloaderWPF/PageChatUpdate.xaml.cs @@ -117,7 +117,7 @@ private async void btnBrowse_Click(object sender, RoutedEventArgs e) { if (VideoId.All(char.IsDigit)) { - GqlVideoResponse videoInfo = await TwitchHelper.GetVideoInfo(int.Parse(VideoId)); + GqlVideoResponse videoInfo = await TwitchHelper.GetVideoInfo(long.Parse(VideoId)); if (videoInfo.data.video == null) { AppendLog(Translations.Strings.ErrorLog + Translations.Strings.UnableToFindThumbnail + ": " + Translations.Strings.VodExpiredOrIdCorrupt); diff --git a/TwitchDownloaderWPF/PageVodDownload.xaml.cs b/TwitchDownloaderWPF/PageVodDownload.xaml.cs index 075a30af..e9fcbaea 100644 --- a/TwitchDownloaderWPF/PageVodDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageVodDownload.xaml.cs @@ -32,7 +32,7 @@ namespace TwitchDownloaderWPF public partial class PageVodDownload : Page { public readonly Dictionary videoQualities = new(); - public int currentVideoId; + public long currentVideoId; public DateTime currentVideoTime; public TimeSpan vodLength; public int viewCount; @@ -82,7 +82,7 @@ private async void btnGetInfo_Click(object sender, RoutedEventArgs e) private async Task GetVideoInfo() { - int videoId = ValidateUrl(textUrl.Text.Trim()); + long videoId = ValidateUrl(textUrl.Text.Trim()); if (videoId <= 0) { MessageBox.Show(Translations.Strings.InvalidVideoLinkIdMessage.Replace(@"\n", Environment.NewLine), Translations.Strings.InvalidVideoLinkId, MessageBoxButton.OK, MessageBoxImage.Error); @@ -275,10 +275,10 @@ public void SetImage(string imageUri, bool isGif) } } - private static int ValidateUrl(string text) + private static long ValidateUrl(string text) { var vodIdMatch = TwitchRegex.MatchVideoId(text); - if (vodIdMatch is {Success: true} && int.TryParse(vodIdMatch.ValueSpan, out var vodId)) + if (vodIdMatch is {Success: true} && long.TryParse(vodIdMatch.ValueSpan, out var vodId)) { return vodId; } diff --git a/TwitchDownloaderWPF/WindowQueueOptions.xaml.cs b/TwitchDownloaderWPF/WindowQueueOptions.xaml.cs index 09513104..f35c922a 100644 --- a/TwitchDownloaderWPF/WindowQueueOptions.xaml.cs +++ b/TwitchDownloaderWPF/WindowQueueOptions.xaml.cs @@ -464,7 +464,7 @@ private void EnqueueDataList() { Oauth = Settings.Default.OAuth, TempFolder = Settings.Default.TempPath, - Id = int.Parse(taskData.Id), + Id = long.Parse(taskData.Id), Quality = (ComboPreferredQuality.SelectedItem as ComboBoxItem)?.Content as string, FfmpegPath = "ffmpeg", TrimBeginning = false, diff --git a/TwitchDownloaderWPF/WindowUrlList.xaml.cs b/TwitchDownloaderWPF/WindowUrlList.xaml.cs index 47eb98ed..08a30f9c 100644 --- a/TwitchDownloaderWPF/WindowUrlList.xaml.cs +++ b/TwitchDownloaderWPF/WindowUrlList.xaml.cs @@ -61,7 +61,7 @@ private async void btnQueue_Click(object sender, RoutedEventArgs e) { if (id.All(char.IsDigit)) { - Task task = TwitchHelper.GetVideoInfo(int.Parse(id)); + Task task = TwitchHelper.GetVideoInfo(long.Parse(id)); taskVideoList.Add(task); taskDict[task.Id] = id; }