参考了玄猫的正则表达式,结合自己的经历写这个东西。前些天百度的大规模封站估计很多人还心有余悸,单纯采集的站已经极度危险的地步了,考虑变通下。很多人觉得修改标题是一个办法,当然还可以结合修改内容来搞,让搜索引擎认为是原创的,这样会获得良好的排名。参考玄猫提供的关键词词频修正表达式,试了下,非常有用,特转过来。
'正则表达式函数
Function doReExec(strng,patrn)
Dim regEx, Match, Matches,RetStr ' 创建变量。
Set regEx = New RegExp ' 创建正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = True ' 设置为不区分大小写。
regEx.Global = True ' 设置全局适用。
Set Matches = regEx.Execute(strng) ' 执行搜索。
For Each Match in Matches ' 对 Matches 集合进行迭代。
RetStr = RetStr & Match.Value & "," & vbCRLF
Next
doReExec = RetStr
End Function
'词频修正函数
Function Original(str)
Dim temparr,ltemp,ltemp2
str = Replace(str,vbCrLf,"")
temparr = ""
If Trim(temparr) = "" Then temparr = doReExec(str,"<p[^>]*>([^<]+)</p>")
If Trim(temparr) = "" Then temparr = doReExec(str,"<br>([^<]+)<br>")
If Trim(temparr) = "" Then temparr = doReExec(str,"<div [^>]*>([^<]+)</div>")
If Trim(temparr) = "" Then temparr = doReExec(str,"<span [^>]*>([^<]+)</span>")
If Trim(temparr) = "" Then Original = str : Exit Function
temparr = Split(temparr,",")
randomize
ltemp = Int(Rnd()*UBound(temparr))+1
ltemp2 = Timer Mod UBound(temparr)
Original = "<div id=""correct""><b>本文摘要</b>:<br />" & temparr(ltemp) & temparr(ltemp2) & "</div>" & str
End Function
Function doReExec(strng,patrn)
Dim regEx, Match, Matches,RetStr ' 创建变量。
Set regEx = New RegExp ' 创建正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = True ' 设置为不区分大小写。
regEx.Global = True ' 设置全局适用。
Set Matches = regEx.Execute(strng) ' 执行搜索。
For Each Match in Matches ' 对 Matches 集合进行迭代。
RetStr = RetStr & Match.Value & "," & vbCRLF
Next
doReExec = RetStr
End Function
'词频修正函数
Function Original(str)
Dim temparr,ltemp,ltemp2
str = Replace(str,vbCrLf,"")
temparr = ""
If Trim(temparr) = "" Then temparr = doReExec(str,"<p[^>]*>([^<]+)</p>")
If Trim(temparr) = "" Then temparr = doReExec(str,"<br>([^<]+)<br>")
If Trim(temparr) = "" Then temparr = doReExec(str,"<div [^>]*>([^<]+)</div>")
If Trim(temparr) = "" Then temparr = doReExec(str,"<span [^>]*>([^<]+)</span>")
If Trim(temparr) = "" Then Original = str : Exit Function
temparr = Split(temparr,",")
randomize
ltemp = Int(Rnd()*UBound(temparr))+1
ltemp2 = Timer Mod UBound(temparr)
Original = "<div id=""correct""><b>本文摘要</b>:<br />" & temparr(ltemp) & temparr(ltemp2) & "</div>" & str
End Function
有问题请到偶的blog上留言www.shiyinglv.com.cn
转载请注明转自 站长网
申请创业报道,分享创业好点子。点击此处,共同探讨创业新机遇!
