public static DCInsideArticle ParseBoardView(string html, bool is_minor = false) { DCInsideArticle article = new DCInsideArticle(); HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); HtmlNode node = document.DocumentNode.SelectNodes("//div[@class='view_content_wrap']")[0]; article.Id = Regex.Match(html, @"name=""gallery_no"" value=""(\d+)""").Groups[1].Value; article.GalleryName = Regex.Match(html, @"<h4 class=""block_gallname"">\[(.*?) ").Groups[1].Value; article.OriginalGalleryName = document.DocumentNode.SelectSingleNode("//input[@id='gallery_id']").GetAttributeValue("value", ""); if (is_minor) { article.Class = node.SelectSingleNode("//span[@class='title_headtext']").InnerText; } article.Contents = node.SelectSingleNode("//div[@class='writing_view_box']").InnerHtml.ToBase64(); article.Title = node.SelectSingleNode("//span[@class='title_subject']").InnerText; try { article.ImagesLink = node.SelectNodes("//ul[@class='appending_file']/li").Select(x => x.SelectSingleNode("./a").GetAttributeValue("href", "")).ToList(); article.FilesName = node.SelectNodes("//ul[@class='appending_file']/li").Select(x => x.SelectSingleNode("./a").InnerText).ToList(); } catch { } article.ESNO = document.DocumentNode.SelectSingleNode("//input[@id='e_s_n_o']").GetAttributeValue("value", ""); return(article); }
public static async Task <DCInsideComment> GetComments(DCInsideArticle article, string page) { var nt = NetTask.MakeDefault("https://gall.dcinside.com/board/comment/"); nt.Headers = new Dictionary <string, string>() { { "X-Requested-With", "XMLHttpRequest" } }; nt.Query = new Dictionary <string, string>() { { "id", article.OriginalGalleryName }, { "no", article.Id }, { "cmt_id", article.OriginalGalleryName }, { "cmt_no", article.Id }, { "e_s_n_o", article.ESNO }, { "comment_page", page } }; return(JsonConvert.DeserializeObject <DCInsideComment>(await NetTools.DownloadStringAsync(nt))); }