Beispiel #1
0
        /// <summary>
        /// 解析插件详情页
        /// </summary>
        /// <param name="html"></param>
        /// <returns></returns>
        public static CurseDetail PraseDetail(string html)
        {
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(html);
            var node = doc.DocumentNode.SelectSingleNode("//main[contains(@class,'project-details__main')]");

            if (null != node)
            {
                var cd = CurseDetail.TryPrase(node.InnerHtml);
                return(cd);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        public static CurseDetail TryPrase(string html)
        {
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(html);
            var         v  = doc.DocumentNode.SelectSingleNode("//span[@class='stats--game-version']");
            CurseDetail cd = new CurseDetail();

            if (null != v)
            {
                cd.version = v.InnerText;
            }
            cd.pages = CurseDetailPage.TryPraseList(html);
            var c = doc.DocumentNode.SelectSingleNode("//section[contains(@class,'project-content')]");

            if (null != c)
            {
                cd.content = c.InnerText;
            }
            return(cd);
        }