diff --git a/New_College.Tasks/HtmlAgSpider/NationWideNewsAgHelper.cs b/New_College.Tasks/HtmlAgSpider/NationWideNewsAgHelper.cs
index a3e73a6..bd0fed9 100644
--- a/New_College.Tasks/HtmlAgSpider/NationWideNewsAgHelper.cs
+++ b/New_College.Tasks/HtmlAgSpider/NationWideNewsAgHelper.cs
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
using System.Text.Json;
using New_College.Common.Helper;
using System.Threading;
+using System.Text.RegularExpressions;
namespace New_College.Tasks
{
public class NationWideNewsAgHelper
@@ -35,7 +36,7 @@ namespace New_College.Tasks
{
resultlist.msg.ForEach(o =>
{
- Thread.Sleep(100);
+ Thread.Sleep(100);
string newsUrl = $"{itemUrl}{o.uri}";
HtmlDocument doc = webClient.Load(newsUrl);
var inntertitle = doc.DocumentNode.SelectSingleNode("//*[@id=\"app\"]/div[2]/h2").InnerText;
@@ -54,19 +55,19 @@ namespace New_College.Tasks
//if (!HtmlHelper.ReplaceHtmlTag(innerhtml).Contains("浏览器"))
//{
- if (innerhtml.Contains(".pdf") || innerhtml.Contains(".doc") || innerhtml.Contains(".docx") || innerhtml.Contains(".xls") || innerhtml.Contains(".xlsx"))
- {
- innerhtml = $"{innerhtml}\n若有附件详情,请至本省招生考试院下载附件!!!";
- }
+ if (innerhtml.Contains(".pdf") || innerhtml.Contains(".doc") || innerhtml.Contains(".docx") || innerhtml.Contains(".xls") || innerhtml.Contains(".xlsx"))
+ {
+ innerhtml = $"{innerhtml}\n若有附件详情,请至本省招生考试院下载附件!!!";
+ }
- list.Add(new NewsModels()
- {
- title = inntertitle,
- author = author,
- pubtime = Convert.ToDateTime(createtime),
- detail = innerhtml.Replace("src=\"", "src=\"https://gaokao.chsi.com.cn")
- });
- // }
+ list.Add(new NewsModels()
+ {
+ title = inntertitle,
+ author = author,
+ pubtime = Convert.ToDateTime(createtime),
+ detail = Regex.Replace(innerhtml, @"src=""(?!https?:\/\/)(.*?)""", @"src=""https://gaokao.chsi.com.cn$1""")
+ });
+ // }
});
}
}