Esempio n. 1
0
        public static DCArticle ParseBoardView(string html, bool is_minor = false)
        {
            DCArticle article = new DCArticle();

            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);
        }
Esempio n. 2
0
        public static DCComment GetComments(DCArticle article, string page)
        {
            var wc = Net.NetCommon.GetDefaultClient();

            wc.Headers.Add("X-Requested-With", "XMLHttpRequest");
            wc.QueryString.Add("id", article.OriginalGalleryName);
            wc.QueryString.Add("no", article.Id);
            wc.QueryString.Add("cmt_id", article.OriginalGalleryName);
            wc.QueryString.Add("cmt_no", article.Id);
            wc.QueryString.Add("e_s_n_o", article.ESNO);
            wc.QueryString.Add("comment_page", page);
            return(JsonConvert.DeserializeObject <DCComment>(Encoding.UTF8.GetString(wc.UploadValues("https://gall.dcinside.com/board/comment/", "POST", wc.QueryString))));
        }
Esempio n. 3
0
        public static DCArticle ParseBoardView(string html)
        {
            DCArticle article = new DCArticle();

            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.Title       = node.SelectSingleNode("//span[@class='title_subject']").InnerText;
            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();

            return(article);
        }