自动踩百度博客的脚本(VBS版)

前一阵子玩模拟精灵,里面有一段代码可以自动踩百度博客,增加回访,代码紧凑细致,效率极高。今天下午忽发奇想,用vbs来实现一下自动踩百度博客。尽管实现了,但是总感觉走了弯路,没有模拟精灵效率高,方法简洁。因为是用于演示,所以只收集了9个页面的博客地址,每次访问也是从头开始,有兴趣的朋友,可以自己修改相应的代码。希望百度管理员不要封我,我没有恶意,呵呵。

code1:

On Error Resume Next

url="http://hi.baidu.com/hi/good0"

'str="http://hi.baidu.com.xuejinglan"

Set ie=WScript.CreateObject("InternetExplorer.Application")

ie.visible=True

atlink=""

For i=1 To 9 Step 1

urll=url & i &".html"

ie.navigate urll

    While ie.Busy

     WScript.Sleep 100

    Wend

Set links=ie.Document.links

Set fso = CreateObject("Scripting.FileSystemObject")

Set f=fso.OpenTextFile("c:\url.txt",8,True)

For Each link In links

If link<>atlink And link<>"http://www.baidu.com/" And

link<>"http://hi.baidu.com/"

And link<>"http://www.baidu.com/search/hi_contract.html" And

link<>"http://www.baidu.com/duty/" And reg(link)<>true Then f.WriteLine link

atlink=link

Next

f.Close

Next

Function reg(str)

Dim regEx, Match, Matches

      Set regEx = New RegExp

           regEx.Pattern = "^http://hi.baidu.com/hi/good"

           regEx.IgnoreCase = True

           regEx.Global = True

Val = regEx.Test(str)

reg =Val

End Function

将此段代码保存为:取得地址.vbs,执行可得到百度空间各博客的地址。

code2:

'str="http://hi.baidu.com.xuejinglan"

Set Wshell=WScript.CreateObject("WScript.Shell")

Set ie=WScript.CreateObject("InternetExplorer.Application")

ie.visible=true

ie.navigate "http://passport.baidu.com/"

Do

Wscript.Sleep 200

Loop Until ie.ReadyState=4

ie.document.getElementById("username").value="xxxxxxx"

ie.document.getElementById("password").value="*******"

tj=ie.document.getElementsBytagname("form")

tj.submit

WScript.Sleep 10000

Set fso = CreateObject("Scripting.FileSystemObject")

Set f=fso.OpenTextFile("c:\url.txt",1,false)

Do While f.AtEndOfLine <> True

url=f.ReadLine

Set ie=WScript.CreateObject("InternetExplorer.Application")

ie.visible=True

ie.navigate url

Do

    Wscript.Sleep 200

Loop Until ie.ReadyState=4

WScript.Sleep 10000

ie.Quit

Loop

将此段代码保存为:踩空间.vbs,执行即可。

你可能感兴趣的:(c,IE,F#,百度,脚本)