diff --git a/Classes/Chapter3qduClass.cs b/Classes/Chapter3qduClass.cs
new file mode 100644
index 0000000000000000000000000000000000000000..a3bdf69c087aa2d93287538c724582496828bc14
--- /dev/null
+++ b/Classes/Chapter3qduClass.cs
@@ -0,0 +1,151 @@
+using HtmlAgilityPack;
+using HtmlToTxtWFA.Utils;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HtmlToTxtWFA.Classes
+{
+ ///
+ /// 章节 3qdu
+ ///
+ public class Chapter3qduClass : ChapterClass
+ {
+ public Chapter3qduClass() { }
+
+ public Chapter3qduClass(HtmlNode aElement)
+ {
+ // 第1章 善恶到头终有豹
+ this.Label = aElement.InnerText;
+ this.Url = aElement.GetAttributeValue("href", "");
+ }
+
+ public override List ReadChapterList(string HOST, string serialNumber)
+ {
+ // https://sk.3qdu.com/xiaoshuo/535016
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ HtmlAgilityPack.HtmlDocument doc = new HtmlWeb().LoadFromWebAsync(HOST + "/xiaoshuo/" + serialNumber, Encoding.GetEncoding("GBK")).Result;
+ if (doc == null)
+ {
+ MessageBox.Show("服务器访问异常");
+ return new List();
+ }
+
+ HtmlNodeCollection oNodes = doc.DocumentNode.SelectNodes(".//option");
+ if (oNodes.Count == 0)
+ {
+ MessageBox.Show("获取章节分页异常");
+ return new List();
+ }
+
+ List chapterList = new List();
+ for (int i = 0; i < oNodes.Count / 2; i++)
+ {
+ chapterList.AddRange(ReadChapterListByPage(oNodes[i].GetAttributeValue("value", "").Replace("https://sk.3qxsw.org", HOST)));
+ }
+
+ return chapterList;
+ }
+
+ private List ReadChapterListByPage(string url)
+ {
+ HtmlAgilityPack.HtmlDocument doc = new HtmlWeb().LoadFromWebAsync(url, Encoding.GetEncoding("GBK")).Result;
+ if (doc == null)
+ {
+ return new List();
+ }
+
+ // 加载章节列表
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ HtmlNodeCollection conNodes = doc.DocumentNode.SelectNodes("//ul[@class=\"p2\"]");
+ if (conNodes.Count != 3)
+ {
+ return new List();
+ }
+
+ HtmlNodeCollection aNodes = conNodes[1].SelectNodes(".//a");
+ if (aNodes == null || aNodes.Count == 0)
+ {
+ return new List();
+ }
+
+ List chapterList = new List();
+ for (int c = 0; c < aNodes.Count; c++)
+ {
+ // 第1章 善恶到头终有豹
+ HtmlNode aNode = aNodes[c];
+ if (aNode == null)
+ {
+ continue;
+ }
+
+ Chapter3qduClass chapterClass = new Chapter3qduClass(aNode);
+ if (!chapterClass.IsNull())
+ {
+ chapterList.Add(chapterClass);
+ }
+ }
+
+ return chapterList;
+ }
+
+ public override void ToTxt(string filePath, string HOST)
+ {
+ HtmlWeb web = new HtmlWeb();
+ HtmlAgilityPack.HtmlDocument doc;
+ HtmlNodeCollection conNodes;
+
+ // 第一页
+ //从url中加载
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ doc = web.LoadFromWebAsync(HOST + this.Url, Encoding.GetEncoding("GBK")).Result;
+ if (doc == null)
+ {
+ return;
+ }
+
+ //写入标题
+ TxtUtil.Write(filePath, " " + this.Label + "\n");
+ conNodes = doc.DocumentNode.SelectNodes("//div[@class=\"novelcontent\"]");
+ if (conNodes == null || conNodes.Count == 0)
+ {
+ return;
+ }
+
+ HtmlNodeCollection pNodes = conNodes[0].SelectNodes(".//p");
+ for (int n = 0; n < pNodes.Count; n++)
+ {
+
+ if (pNodes[n].InnerText.Contains("本章未完 点击下一页继续阅读"))
+ {
+ // 过滤 本章未完 点击下一页继续阅读
+ continue;
+ }
+ TxtUtil.Write(filePath, " " + pNodes[n].InnerText + "\n");
+ }
+
+ // 第二页
+ //从url中加载
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ doc = web.LoadFromWebAsync(HOST + this.Url.Replace(".html", "_2.html"), Encoding.GetEncoding("GBK")).Result;
+ if (doc == null)
+ {
+ return;
+ }
+
+ conNodes = doc.DocumentNode.SelectNodes("//div[@class=\"novelcontent\"]");
+ if (conNodes == null || conNodes.Count == 0)
+ {
+ return;
+ }
+
+ pNodes = conNodes[0].SelectNodes(".//p");
+ for (int n = 0; n < pNodes.Count; n++)
+ {
+ TxtUtil.Write(filePath, " " + pNodes[n].InnerText + "\n");
+ }
+
+ TxtUtil.Write(filePath, "\n");
+ }
+ }
+}
diff --git a/Classes/Chapter3qxswClass.cs b/Classes/Chapter3qxswClass.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d511a2e33751aab11b3bc721a14084e05a3d185d
--- /dev/null
+++ b/Classes/Chapter3qxswClass.cs
@@ -0,0 +1,145 @@
+using HtmlAgilityPack;
+using HtmlToTxtWFA.Utils;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HtmlToTxtWFA.Classes
+{
+ ///
+ /// 章节 3qxsw
+ ///
+ public class Chapter3qxswClass : ChapterClass
+ {
+ public Chapter3qxswClass() { }
+
+ public Chapter3qxswClass(HtmlNode aElement)
+ {
+ // 第1章 自救者天救之
+ this.Label = aElement.InnerText;
+ this.Url = aElement.GetAttributeValue("href", "");
+ }
+
+ public override List ReadChapterList(string HOST, string serialNumber)
+ {
+ // https://sk.3qxsw.org/xiaoshuo/462076/
+ HtmlAgilityPack.HtmlDocument doc = new HtmlWeb().LoadFromWebAsync(HOST + "/xiaoshuo/" + serialNumber, Encoding.UTF8).Result;
+ if (doc == null)
+ {
+ MessageBox.Show("服务器访问异常");
+ return new List();
+ }
+
+ HtmlNodeCollection oNodes = doc.DocumentNode.SelectNodes(".//option");
+ if (oNodes.Count == 0)
+ {
+ MessageBox.Show("获取章节分页异常");
+ return new List();
+ }
+
+ List chapterList = new List();
+ for (int i = 0; i < oNodes.Count / 2; i++)
+ {
+ chapterList.AddRange(ReadChapterListByPage(HOST + oNodes[i].GetAttributeValue("value", "")));
+ }
+
+ return chapterList;
+ }
+
+ private List ReadChapterListByPage(string url)
+ {
+ HtmlAgilityPack.HtmlDocument doc = new HtmlWeb().LoadFromWebAsync(url, Encoding.UTF8).Result;
+ if (doc == null)
+ {
+ return new List();
+ }
+
+ // 加载章节列表
+ HtmlNodeCollection conNodes = doc.DocumentNode.SelectNodes("//ul[@class=\"p2\"]");
+ if (conNodes.Count != 3)
+ {
+ return new List();
+ }
+
+ HtmlNodeCollection aNodes = conNodes[1].SelectNodes(".//a");
+ if (aNodes == null || aNodes.Count == 0)
+ {
+ return new List();
+ }
+
+ List chapterList = new List();
+ for (int c = 0; c < aNodes.Count; c++)
+ {
+ // 第1章 自救者天救之
+ HtmlNode aNode = aNodes[c];
+ if (aNode == null)
+ {
+ continue;
+ }
+
+ Chapter3qxswClass chapterClass = new Chapter3qxswClass(aNode);
+ if (!chapterClass.IsNull())
+ {
+ chapterList.Add(chapterClass);
+ }
+ }
+
+ return chapterList;
+ }
+
+ public override void ToTxt(string filePath, string HOST)
+ {
+ HtmlWeb web = new HtmlWeb();
+ HtmlAgilityPack.HtmlDocument doc;
+ HtmlNodeCollection conNodes;
+
+ // 第一页
+ //从url中加载
+ doc = web.LoadFromWebAsync(HOST + this.Url, Encoding.UTF8).Result;
+ if (doc == null)
+ {
+ return;
+ }
+
+ //写入标题
+ TxtUtil.Write(filePath, " " + this.Label + "\n");
+ conNodes = doc.DocumentNode.SelectNodes("//div[@class=\"novelcontent\"]");
+ if (conNodes == null || conNodes.Count == 0)
+ {
+ return;
+ }
+
+ HtmlNodeCollection pNodes = conNodes[0].SelectNodes(".//p");
+ for (int n = 0; n < pNodes.Count; n++)
+ {
+ if (!pNodes[n].GetAttributeValue("align", "").Equals(""))
+ {
+ // 过滤非正文
+ continue;
+ }
+
+ TxtUtil.Write(filePath, " " + pNodes[n].InnerText + "\n");
+ }
+
+ // 第二页
+ //从url中加载
+ doc = web.LoadFromWebAsync(HOST + this.Url.Replace(".html", "_2.html"), Encoding.UTF8).Result;
+ if (doc == null)
+ {
+ return;
+ }
+
+ conNodes = doc.DocumentNode.SelectNodes("//div[@class=\"novelcontent\"]");
+ if (conNodes == null || conNodes.Count == 0)
+ {
+ return;
+ }
+
+ pNodes = conNodes[0].SelectNodes(".//p");
+ for (int n = 0; n < pNodes.Count; n++)
+ {
+ TxtUtil.Write(filePath, " " + pNodes[n].InnerText + "\n");
+ }
+ }
+ }
+}
diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs
index 1f179f3026529bc03bc27d91b5ae5f15ee0a8dd6..85edd099856478ed84a19721a8352dd36e02180b 100644
--- a/MainForm.Designer.cs
+++ b/MainForm.Designer.cs
@@ -158,6 +158,8 @@ namespace HtmlToTxtWFA
this.platformComboBox.FormattingEnabled = true;
this.platformComboBox.Items.AddRange(new object[] {
"20小说网",
+ "3Q读书网",
+ "3Q中文网",
"4020电子书下载",
"7小说",
"笔趣阁",
diff --git a/MainForm.cs b/MainForm.cs
index 5e8d61c6b82f4524aa6032d6ea50178d416d612c..9930ada723c769827c5e6e9e9752eaabd5deea3a 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -13,6 +13,8 @@ namespace HtmlToTxtWFA
private static Dictionary HOSTList = new Dictionary()
{
["20小说网"] = "https://www.20xs.org",
+ ["3Q读书网"] = "https://sk.3qdu.com",
+ ["3Q中文网"] = "https://sk.3qxsw.org",
["4020电子书下载"] = "https://www.iwurexs.net",
["7小说"] = "https://www.7qs.org",
["笔趣阁"] = "http://www.ibiquge.cc",
@@ -103,6 +105,14 @@ namespace HtmlToTxtWFA
{
chapterList = new Chapter20xsClass().ReadChapterList(host, serialNumber);
}
+ else if (platform.Equals("3Q读书网"))
+ {
+ chapterList = new Chapter3qduClass().ReadChapterList(host, serialNumber);
+ }
+ else if (platform.Equals("3Q中文网"))
+ {
+ chapterList = new Chapter3qxswClass().ReadChapterList(host, serialNumber);
+ }
else if (platform.Equals("4020电子书下载"))
{
chapterList = new ChapterIwurexsClass().ReadChapterList(host, serialNumber);