diff --git a/Novel.cs b/Novel.cs index 5435ed7..3a1743a 100644 --- a/Novel.cs +++ b/Novel.cs @@ -279,7 +279,8 @@ private void getUserDetail() string _nick = tb.SelectSingleNode("./tr[" + (isWriter? "3" : "2") + "]/td[2]/div").InnerText; if (_nick != "您还没有设置昵称") userDetail += " " + _nick; - userDetail += " "+tb.SelectSingleNode("./tr[" + (isWriter ? "8" : "7") + "]//div/span").InnerText; + // disable email for now + // userDetail += " "+tb.SelectSingleNode("./tr[" + (isWriter ? "8" : "7") + "]//td[@id='emailtd']/text()").InnerText; } private string stripEmpty(string input) @@ -430,7 +431,7 @@ public Chapter getSingleChapter(int chapter) } else { - HtmlNode novelnode = root.SelectSingleNode("//div[contains(@class,'noveltext')]"); + HtmlNode novelnode = root.SelectSingleNode("//div[@class='novelbody']/div"); if(novelnode == null) { throw new Exception("章节" + chapter + (isVip ? "是VIP章节,请登陆ww":"解析失败")); @@ -491,8 +492,31 @@ public Chapter getSingleChapter(int chapter) mainbody = novelnode.InnerHtml; } + var styles = ""; + foreach (var e in root.SelectNodes("//style")) + { + styles += e.InnerText; + } + var cssRegexStr = @"[^{]+{\s*content\s*:\s*['""](.*?)['""]\s*;*\s*}"; + mainbody = Regex.Replace(mainbody, @"([^<]+)", m => { + var clsName = m.Groups[1].Value; + var text = m.Groups[2].Value; + var mb = Regex.Match(styles, clsName + ":before" + cssRegexStr); + if(mb.Success) + { + text = mb.Groups[1].Value + text; + } + var ma = Regex.Match(styles, clsName + ":after" + cssRegexStr); + if (ma.Success) + { + text += ma.Groups[1].Value; + } + return text; + }); + + mainbody = HtmlEntity.DeEntitize( - mainbody.Replace("
", "\r\n").Replace("
", "\r\n")); + mainbody.Replace("
", "\r\n").Replace("
", "\r\n").Replace("‌", "")); if (fontName != "") { @@ -501,8 +525,6 @@ public Chapter getSingleChapter(int chapter) chpt.content = "  " + mainbody.Replace("@无限好文,尽在晋江文学城", "").Replace("@无限好文,尽晋江文学城","").Trim() + chpt.content; - - } chpt.chapterIndex = chapter; setPrompt("章节"+chapter+"("+chpt.title+")已完成"); diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index b66e042..f3b93f9 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.2")] -[assembly: AssemblyFileVersion("1.4.2")] +[assembly: AssemblyVersion("1.4.3")] +[assembly: AssemblyFileVersion("1.4.3")] diff --git a/jjget.csproj b/jjget.csproj index 2573753..65d2f22 100644 --- a/jjget.csproj +++ b/jjget.csproj @@ -142,13 +142,13 @@ - 1.11.46 + 1.11.50 2.0.18 - 13.0.2 + 13.0.3