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); }
    }
    public static Player RetrievePlayer(string PageContent)
    {
        IList <Player> PlayerQualityTypes = new List <Player>();

        Bitrate[] Bitrates = { Bitrate.Create(5000, Quality.High), Bitrate.Create(0, Quality.MediumHighest), Bitrate.Create(2500, Quality.Medium), Bitrate.Create(1500, Quality.Low), Bitrate.Create(600, Quality.VeryLow) };


        foreach (var Bitrate in Bitrates)
        {
            string Url = ScrapeBit.FirstString(PageContent, "{\"bitrate\":" + Bitrate.amount + ",\"playUrl\":\"", "\","); // FHD High Bitrate

            if (Url == null)
            {
                continue;
            }
            else
            {
                return(new Player(Url, Bitrate.quality));
            }
        }
        return(new Player(null, Quality.NotFound));
    }
 public static string FirstFrom(string Source, Scrape scrape)
 {
     return(ScrapeBit.FirstString(Source, scrape.SearchString, scrape.SearchUntilString));
 }