public async Task <BasicStreamInfo> GetLivestreamStatusFromChannelId(string ChannelId) { try { var client = new RestClient($"https://www.youtube.com/channel/{ChannelId}/live"); client.Timeout = 8000; var request = new RestRequest(Method.GET); request.AddCookie("CONSENT", "YES+cb"); IRestResponse response = await client.ExecuteAsync(request); if (response.StatusCode == HttpStatusCode.NotFound) { CMessage.GotResponseNonExistentUser(ChannelId, API_NAME); return(BasicStreamInfo.Empty); } string videoId = ScrapeBit.FirstString(response.Content, "\"videoDetails\":{\"videoId\":\"", "\""); if (videoId == null) { return(BasicStreamInfo.Empty); } if (response.Content.Contains("LIVE_STREAM_OFFLINE")) { CMessage.GotResponseScheduledLivestream(ChannelId, API_NAME); return(BasicStreamInfo.Empty); } else { return(new BasicStreamInfo(true, videoId)); } } catch (Exception) { return(BasicStreamInfo.Empty); } }