Files
KJD/Work/CollectClass/LoadCloudData.cs
T
2025-06-29 19:38:31 +08:00

81 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AllBase;
namespace Work.CollectClass
{
public class LoadCloudData
{
/// <summary>
/// 过滤标题词
/// </summary>
public static List<string> NoTitleWord = new List<string>();
/// <summary>
/// 过来品牌词
/// </summary>
public static List<string> NoBrand = new List<string>();
/// <summary>
/// 加载云词
/// </summary>
public void Get()
{
string url = BaseClass.LoginApiUrl + "taobao/筛选词.txt";
string path = "temp/notitleword.tjm";
string html;
if (FileBase.Exists(path))
html = FileBase.ReadAllText(path, Encoding.Default);
else
{
html = GetHtml.Utf8(url);
FileBase.WriteAllText(path, html, Encoding.Default);
}
if (string.IsNullOrEmpty(html))
{
LogSave.Add("链接云数据库失败");
return;
}
string[] l = html.Split('\n');
for (int i = 0; i < l.Length; i++)
{
string s = l[i].Trim();
if (string.IsNullOrEmpty(s) || s.Length < 2)
continue;
string num = BaseRegex.GetMatchRegexString(ref s, @"([\d]+)");
if (!string.IsNullOrEmpty(num) && num.Length == s.Length)
continue;
NoTitleWord.Add(s);
}
url = BaseClass.LoginApiUrl + "taobao/品牌词.txt";
path = "temp/nobrand.tjm";
if (FileBase.Exists(path))
html = FileBase.ReadAllText(path, Encoding.Default);
else
{
html = GetHtml.Utf8(url);
FileBase.WriteAllText(path, html, Encoding.Default);
}
if (string.IsNullOrEmpty(html))
{
LogSave.Add("链接云数据库失败");
return;
}
l = html.Split('\n');
for (int i = 0; i < l.Length; i++)
{
string s = l[i].Trim();
if (string.IsNullOrEmpty(s) || s.Length < 2)
continue;
string num = BaseRegex.GetMatchRegexString(ref s, @"([\d]+)");
if (!string.IsNullOrEmpty(num) && num.Length == s.Length)
continue;
NoBrand.Add(s);
}
}
}
}