From 63c17d05b910d2ff596893b9ce12560638c5741b Mon Sep 17 00:00:00 2001
From: Fengshaoyuan <1914442689@qq.com>
Date: Thu, 23 May 2024 09:05:54 +0800
Subject: [PATCH] =?UTF-8?q?1.=E6=89=A9=E5=B1=95=205you8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
017.PluginIn5you8/017.PluginIn5you8.csproj | 67 ++++++++++++++++++++
017.PluginIn5you8/Chapter5you8Class.cs | 48 ++++++++++++++
017.PluginIn5you8/Platform5you8Class.cs | 67 ++++++++++++++++++++
017.PluginIn5you8/Properties/AssemblyInfo.cs | 36 +++++++++++
017.PluginIn5you8/packages.config | 5 ++
HtmlToTxtWFA.sln | 6 ++
6 files changed, 229 insertions(+)
create mode 100644 017.PluginIn5you8/017.PluginIn5you8.csproj
create mode 100644 017.PluginIn5you8/Chapter5you8Class.cs
create mode 100644 017.PluginIn5you8/Platform5you8Class.cs
create mode 100644 017.PluginIn5you8/Properties/AssemblyInfo.cs
create mode 100644 017.PluginIn5you8/packages.config
diff --git a/017.PluginIn5you8/017.PluginIn5you8.csproj b/017.PluginIn5you8/017.PluginIn5you8.csproj
new file mode 100644
index 0000000..e593ece
--- /dev/null
+++ b/017.PluginIn5you8/017.PluginIn5you8.csproj
@@ -0,0 +1,67 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {44B39D79-BB61-4BB5-AF3C-450CD1003760}
+ Library
+ Properties
+ HtmlToTxtWFA.Plugin
+ PluginIn5you8
+ v4.6
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\HtmlAgilityPack.1.11.61\lib\Net45\HtmlAgilityPack.dll
+
+
+
+
+ ..\packages\System.Text.Encoding.CodePages.4.0.1\lib\net46\System.Text.Encoding.CodePages.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {5cd1fa3c-fb67-4b08-bc3e-969b4df3690d}
+ 000.PluginInBase
+
+
+
+
+
+
+
+ copy /Y "$(TargetDir)PluginIn5you8.dll" "$(SolutionDir)bin\Plugins"
+
+
\ No newline at end of file
diff --git a/017.PluginIn5you8/Chapter5you8Class.cs b/017.PluginIn5you8/Chapter5you8Class.cs
new file mode 100644
index 0000000..cc4f9fb
--- /dev/null
+++ b/017.PluginIn5you8/Chapter5you8Class.cs
@@ -0,0 +1,48 @@
+using HtmlAgilityPack;
+using HtmlToTxtWFA.Utils;
+using System.Text;
+
+namespace HtmlToTxtWFA.Plugin
+{
+ ///
+ /// 章节 5you8
+ ///
+ public class Chapter5you8Class : ChapterClass
+ {
+ ///
+ /// 章节序号
+ ///
+ public string SerialNumber { get; set; }
+
+ public Chapter5you8Class(HtmlNode aElement, string serialNumber)
+ {
+ // 第一章梦
+ this.Label = aElement.InnerText;
+ this.Url = aElement.GetAttributeValue("href", "");
+ this.SerialNumber = serialNumber;
+ }
+
+ public override void ToTxt(string filePath, string Host)
+ {
+ // 从url中加载
+ // http://www.5you8.net/76/76262/33670603.html
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ HtmlDocument doc = new HtmlWeb().LoadFromWebAsync(Host + "/" + this.SerialNumber + "/" + this.Url, Encoding.GetEncoding("GBK")).Result;
+ if (doc == null)
+ {
+ return;
+ }
+
+ HtmlNodeCollection conNodes = doc.DocumentNode.SelectNodes("//p[@id='articlecontent']");
+ if (conNodes == null || conNodes.Count == 0)
+ {
+ return;
+ }
+
+ TxtUtil.Write(filePath, " " + this.Label + "\n\n"
+ + conNodes[0].InnerHtml.Replace(" ", " ").Replace("
", "")
+ + "\n\n"
+ );
+ }
+ }
+}
diff --git a/017.PluginIn5you8/Platform5you8Class.cs b/017.PluginIn5you8/Platform5you8Class.cs
new file mode 100644
index 0000000..2bb2eaf
--- /dev/null
+++ b/017.PluginIn5you8/Platform5you8Class.cs
@@ -0,0 +1,67 @@
+using HtmlAgilityPack;
+using System.Collections.Generic;
+using System.Text;
+
+namespace HtmlToTxtWFA.Plugin
+{
+ public class Platform5you8Class : PlatformClass
+ {
+ public override string GetName()
+ {
+ return "5笔趣阁";
+ }
+
+ public override string GetHost()
+ {
+ return "http://www.5you8.net";
+ }
+
+ public override string GetDesc()
+ {
+ return "5笔趣阁";
+ }
+
+ public override List ReadChapterList(string serialNumber)
+ {
+ // 从url中加载
+ // http://www.5you8.net/76/76262
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ HtmlDocument doc = new HtmlWeb().LoadFromWebAsync(GetHost() + "/" + serialNumber + "/", Encoding.GetEncoding("GBK")).Result;
+ if (doc == null)
+ {
+ return new List();
+ }
+
+ HtmlNodeCollection conNodes = doc.DocumentNode.SelectNodes("//div[@class=\"ml_list\"]");
+ if (conNodes == null || conNodes.Count == 0)
+ {
+ return new List();
+ }
+
+ HtmlNodeCollection aNodes = conNodes[0].SelectNodes(".//a");
+ if (aNodes == null || aNodes.Count == 0)
+ {
+ return new List();
+ }
+
+ List chapterList = new List();
+ for (int c = 0; c < aNodes.Count; c++)
+ {
+ // 第一章梦
+ HtmlNode aNode = aNodes[c];
+ if (aNode == null)
+ {
+ continue;
+ }
+
+ Chapter5you8Class chapterClass = new Chapter5you8Class(aNode, serialNumber);
+ if (!chapterClass.IsNull())
+ {
+ chapterList.Add(chapterClass);
+ }
+ }
+
+ return chapterList;
+ }
+ }
+}
\ No newline at end of file
diff --git a/017.PluginIn5you8/Properties/AssemblyInfo.cs b/017.PluginIn5you8/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..8063c3e
--- /dev/null
+++ b/017.PluginIn5you8/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("017.PluginIn5you8")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("017.PluginIn5you8")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2024")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("44b39d79-bb61-4bb5-af3c-450cd1003760")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/017.PluginIn5you8/packages.config b/017.PluginIn5you8/packages.config
new file mode 100644
index 0000000..d1b2dbc
--- /dev/null
+++ b/017.PluginIn5you8/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/HtmlToTxtWFA.sln b/HtmlToTxtWFA.sln
index 7ed4b01..b05f490 100644
--- a/HtmlToTxtWFA.sln
+++ b/HtmlToTxtWFA.sln
@@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "015.PluginInSudugu", "015.P
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "016.PluginInTycqzw", "016.PluginInTycqzw\016.PluginInTycqzw.csproj", "{CCA81CE9-8B8D-41B7-B5B4-CB541F64C145}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "017.PluginIn5you8", "017.PluginIn5you8\017.PluginIn5you8.csproj", "{44B39D79-BB61-4BB5-AF3C-450CD1003760}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -111,6 +113,10 @@ Global
{CCA81CE9-8B8D-41B7-B5B4-CB541F64C145}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCA81CE9-8B8D-41B7-B5B4-CB541F64C145}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCA81CE9-8B8D-41B7-B5B4-CB541F64C145}.Release|Any CPU.Build.0 = Release|Any CPU
+ {44B39D79-BB61-4BB5-AF3C-450CD1003760}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {44B39D79-BB61-4BB5-AF3C-450CD1003760}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {44B39D79-BB61-4BB5-AF3C-450CD1003760}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {44B39D79-BB61-4BB5-AF3C-450CD1003760}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
--
Gitee