互动贴:【神梦教程】实战 - 采集按键精灵论坛信息效果一览:(涉及知识 split、get、如何选取分割特征)
讲解:- 取版面源文件 = Lib.网络.获得网页源文件_增强版("http://bbs.anjian.com/showforum-281-1.aspx", "utf-8")'对应图
- Call Plugin.Sys.SetCLB(取版面源文件)‘复制到txt查看帖子
复制代码

- 取版面所有帖子链接=GetStrAB(取版面源文件,"topicid=","&page")
- TracePrint 取版面所有帖子链接
复制代码’返回结果
698249*697539*697758*697756*697288*697741*697854*697825*697779*698279*698252*666970*698253*698272*692305*698196*697785*697799*697988*697469*698266*



- 取版面源文件 = Lib.网络.获得网页源文件_增强版("http://bbs.anjian.com/showforum-281-1.aspx", "utf-8")'对应图
- Call Plugin.Sys.SetCLB(取版面源文件)
- 取版面所有帖子链接=GetStrAB(取版面源文件,"topicid=","&page")
- TracePrint 取版面所有帖子链接
- 帖子链接 = split(取版面所有帖子链接, "*")
- For i = 0 To UBound(帖子链接) - 1
- 帖子链接1= "http://bbs.anjian.com/showtopic-" & 帖子链接(i) & ".aspx"
- 取帖子源文件 = Lib.网络.获得网页源文件_增强版(帖子链接1, "utf-8")
- Call Plugin.Sys.SetCLB(取帖子源文件)
- Next
复制代码







for i=281 to 285 取版面源文件 = Lib.网络.获得网页源文件_增强版("http://bbs.anjian.com/showforum-"&i&"-1.aspx", "utf-8")'对应图
Call Plugin.Sys.SetCLB(取版面源文件)
取版面所有帖子链接=GetStrAB(取版面源文件,"topicid=","&page")
TracePrint 取版面所有帖子链接
帖子链接 = split(取版面所有帖子链接, "*")
For i = 0 To UBound(帖子链接) - 1
帖子链接1= "http://bbs.anjian.com/showtopic-" & 帖子链接(i) & ".aspx"
取帖子源文件 = Lib.网络.获得网页源文件_增强版(帖子链接1, "utf-8")
Call Plugin.Sys.SetCLB(取帖子源文件)
TracePrint GetStrA(取帖子源文件, "<!-- <title>", " ")
userid=GetStrA(取帖子源文件, "userid=",chr(34))
TracePrint GetStrA(取帖子源文件,"userid="& userid &chr(34)&" target="&chr(34)&"_blank"&chr(34)&">", "<")
TracePrint GetStrA(取帖子源文件, "var creditnotice='", "';")
Next
Next
Function GetStrA(Str, StrA, StrB)'取第一关符合特征的
If InStr(Str,StrA)>0 And InStr(Str,StrB)>0 Then GetStrA=Split(Split(Str,StrA)(1),StrB)(0)
End Function
Function GetStrAB(Str, StrA, StrB)'取所有符合特征的
Dim i,ArrStrA,Ck
ArrStrA=Split(Str,StrA)
For i = 1 To UBound(ArrStrA)
If InStr(ArrStrA(i), StrB) > 0 Then Ck = Ck & Split(ArrStrA(i),StrB)(0) &"*"
Next
If UBound(split(ck, "*")) = 1 Then
GetStrAB=Replace(ck,"*","")
Else
GetStrAB=Ck
End If
End Function