目的是把多个Tracker 服务器下载合并到一个txt文档去除空行和重复项。
用GPT生成的vbs脚本去空行、删除重复项无效,请问大佬们要怎么修改?谢谢- Dim objFSO, objShell, objHTTP, strURL, strContent, arrURLs, line, uniqueContent
-
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objShell = CreateObject("WScript.Shell")
- Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
-
- ' 创建一个字典对象用于存储唯一内容
- Set uniqueContent = CreateObject("Scripting.Dictionary")
-
- ' 定义要下载内容的URL数组
- arrURLs = Array( _
- "https://raw.githubusercontent.com/Tunglies/TrackersList/main/all.txt", _
- "https://cf.trackerslist.com/best.txt", _
- "https://raw.adysec.com/adysec/tracker/main/trackers_best.txt", _
- "https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt", _
- "https://raw.githubusercontent.com/DeSireFire/animeTrackerList/master/AT_all_https.txt" _
- )
-
- ' 遍历每个URL,下载内容并合并到uniqueContent中
- For Each strURL In arrURLs
- objHTTP.open "GET", strURL, False
- objHTTP.send
-
- If objHTTP.Status = 200 Then
- strContent = objHTTP.ResponseText
- For Each line In Split(strContent, vbCrLf)
- ' 排除空行
- If Trim(line) <> "" Then
- If Not uniqueContent.Exists(line) Then
- uniqueContent.Add line, ""
- End If
- End If
- Next
- End If
- Next
-
- ' 将合并的内容写入文件
- Set objOutputFile = objFSO.CreateTextFile("combined_content.txt", True)
- For Each item In uniqueContent.Keys
- objOutputFile.WriteLine(item)
- Next
- objOutputFile.Close
-
- Set objFSO = Nothing
- Set objShell = Nothing
- Set objHTTP = Nothing
- Set uniqueContent = Nothing
复制代码
|