BiliRanking.BiliInterface.GetFlvUrl C# (CSharp) Method

GetFlvUrl() public static method

public static GetFlvUrl ( uint cid ) : string
cid uint
return string
        public static string GetFlvUrl(uint cid)
        {
            string url = $"http://interface.bilibili.tv/playurl?appkey={appkey}&cid=";
            string html = GetHtml(url + cid);
            if (!html.Contains("<result>su"))
            {
                Log.Error("FLV地址获取失败! - CID:" + cid);
                return null;
            }

            byte[] byteArray = Encoding.UTF8.GetBytes(html);
            MemoryStream stream = new MemoryStream(byteArray);
            XElement xe = XElement.Load(stream);
            var t = xe.Elements("url");
            IEnumerable<string> elements = from ele in xe.Descendants("url") //where ele.Name == "url"
                                             select ele.Value;
            return elements.ToArray()[0];
        }