Ejemplo n.º 1
0
        async Task <lrtsBookInfo> GetBookInfo(string url)
        {
            lrtsBookInfo lrtsBookInfo = new lrtsBookInfo();
            var          result       = await GetHtml(new HttpItem()
            {
                URL = url, Cookie = __cookie
            });

            __cookie = result.Cookie;
            HtmlParser htmlParser = new HtmlParser();
            string     tmp        = null;

            try { tmp = htmlParser.ParseDocument(result.Html).QuerySelectorAll("ul#pul").FirstOrDefault().QuerySelectorAll("a").FirstOrDefault().GetAttribute("player-info"); } catch { }
            if (tmp != null)
            {
                var array = tmp.Split('&');
                foreach (string str in array)
                {
                    if (str.IndexOf("type") >= 0)
                    {
                        lrtsBookInfo.booktype = str.Replace("type=", "");
                    }
                    if (str.IndexOf("resourcesid") >= 0)
                    {
                        lrtsBookInfo.bookid = str.Replace("resourcesid=", "");
                    }
                }
            }
            return(lrtsBookInfo);
        }
Ejemplo n.º 2
0
        async Task <bool> GetPlayList(List <lrtsFileModel> lst, lrtsBookInfo lrtsBookInfo, int number = 1)
        {
            string url    = "http://www.lrts.me/ajax/playlist/" + lrtsBookInfo.booktype + "/" + lrtsBookInfo.bookid + "/" + number.ToString();
            var    result = await GetHtml(new HttpItem()
            {
                URL = url, Cookie = __cookie
            });

            __cookie = result.Cookie;
            string     html       = HttpUtility.HtmlDecode(result.Html);
            HtmlParser htmlParser = new HtmlParser();
            var        _lst       = htmlParser.ParseDocument(html).QuerySelectorAll("div.column1").Select(t => new lrtsFileModel()
            {
                player_r_name        = t.QuerySelectorAll("input")[4].GetAttribute("value"),
                sectionid            = t.QuerySelectorAll("input")[3].GetAttribute("value"),
                source               = t.QuerySelectorAll("input")[0].GetAttribute("value"),
                share_entityType     = t.QuerySelectorAll("input")[7].GetAttribute("value"),
                share_fatherEntityId = t.QuerySelectorAll("input")[6].GetAttribute("value"),
            });

            lst.AddRange(_lst);
            if (_lst.Count() >= 10)
            {
                await GetPlayList(lst, lrtsBookInfo, (number + 10));
            }
            return(true);
        }