public async Task Run() { try { var Status = await GetLivestreamStatusFromChannelId(ChannelId); if (!Status.IsLivestreaming) { return; } var ytExplode = new YoutubeClient(); var metadata = await ytExplode.Videos.GetAsync(Status.videoId); var UploadInformation = new YoutubeUpload() { Title = metadata.Title, Description = metadata.Description, ThumbnailPath = FilePaths.GetThumbnailPath(FileName.Purify($"{metadata.Title} [{DateTime.Now.Ticks.GetHashCode()}].jpeg")), LivestreamPath = FilePaths.GetLivestreamsPath(FileName.Purify($"{metadata.Title} [{DateTime.Now.Ticks.GetHashCode()}].mp4")) }; CMessage.LivestreamFound(metadata.Title, Platform.YouTube); try { // Try in a try, because sometimes thumbnail downloads fails // if not this try block it will not download the livestream and will not upload new WebClient().DownloadFile(metadata.Thumbnails.MaxResUrl, UploadInformation.ThumbnailPath); } catch (Exception) { } await Streamlink.Download(UploadInformation.LivestreamPath, metadata.Url); var Upload = new Youtube(FilePaths.SecretsFile); await Upload.Init(); _ = Upload.UploadWithRetry(UploadInformation, TimeSpan.FromHours(3)); } catch (Exception x) { CError.ErrorInRunBlock(API_NAME, x.Message); } }