Example #1
0
        /// <summary>
        /// 获取m3u8 url
        /// </summary>
        /// <param name="url"></param>
        public static string GetDownloadUrl(string url)
        {
            var html = session.Get(url) as string;

            if (!String.IsNullOrEmpty(html))
            {
                // 截取video标签
                var script = StrHelper.GetStrBetween(html, "<video id=\"player_one\"", "</script>");
                if (!String.IsNullOrEmpty(script))
                {
                    // document.write(strencode2("  xxxx ")

                    var m3u8url = StrHelper.GetStrBetween(script, "document.write(strencode2(\"", "\"");
                    if (!String.IsNullOrEmpty(url))
                    {
                        m3u8url = StrHelper.URLDecode(m3u8url);

                        // <source src='xxx.m3u8' type='application/x-mpegURL'>

                        m3u8url = StrHelper.GetStrBetween(m3u8url, "<source src='", "'");
                        return(m3u8url);
                    }
                }
            }
            return(null);
        }
Example #2
0
            public override void Run()
            {
                var html = session.Get("http://time.tianqi.com/") as string;

                if (html != null)
                {
                    var time = StrHelper.GetStrBetween(html, "<p id=\"times\">", "</p>");
                    Debug.WriteLine(time);
                }
            }
Example #3
0
 public static string GetFormHiddens(string html, string name)
 {
     return(StrHelper.GetStrBetween(html, "name=\"" + name + "\" value=\"", "\""));
 }