예제 #1
0
        /// <summary>
        /// 解析正文内容
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static async Task <string> GetCatalogContent(string url)
        {
            Debug.WriteLine(url);
            var html = await GetHtmlByUrl(url);

            html = AnalisysSourceHtmlHelper.AnalisysHtml(url, html, AnalisysType.Content)?.ToString();
            return(html);
        }
예제 #2
0
        //catalogs:[BookCatalog]?, introduction:String?,author:String?, cover:String?)
        /// <summary>
        /// 解析目录页数据
        /// </summary>
        /// <param name="url"></param>
        /// <param name="bookId"></param>
        /// <returns>目录列表,简介,封面地址,作者</returns>
        public static async Task <Tuple <List <BookCatalog>, string, string, string> > GetCatalogPageData(string url, string bookId)
        {
            var html = await GetHtmlByUrl(url);

            var value = AnalisysSourceHtmlHelper.AnalisysHtml(url, html, AnalisysType.CatalogPageData);

            var reslut = value as Tuple <List <BookCatalog>, string, string, string>;

            if (reslut?.Item1 == null || reslut.Item1.Count == 0)
            {
                return(null);
            }

            foreach (var bookCatalog in reslut.Item1)
            {
                bookCatalog.BookId = bookId;
            }
            return(reslut);
        }
예제 #3
0
 public static string AnalisysCatalogContent(string url, string html)
 {
     html = AnalisysSourceHtmlHelper.AnalisysHtml(url, html, AnalisysType.Content)?.ToString();
     return(html);
 }
예제 #4
0
        /// <summary>
        /// 解析目录页地址
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static string GetCatalogPageUrl(string url)
        {
            var catalogUrl = AnalisysSourceHtmlHelper.AnalisysHtml(url, null, type: AnalisysType.CatalogPageUrl);

            return(catalogUrl?.ToString());
        }