Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the baidublogbak.vbs code of Baidu space backup script

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "Baidu space backup script baidublogbak.vbs code how to use", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "Baidu space backup script baidublogbak.vbs code how to use" this article.

'example of usage:

'cscript bak.vbs Baidu user name page I to page n directory list .htm user name password

'for example, my blgo example:

'cscript baidublogbak.vbs myvbscript 0 3 url.htm myvbscript mima

'back up from page 0 to page 3, the total number of pages of blog can be seen by opening the http://hi.baidu.com/ user name / blog/index/0. Url.htm stores a list of directories

Note that Baidu counts from page 0

You can back up your user name and password if you write them, but you cannot back up private documents.

It is recommended to back up a few pages and several pages. It is best to set up a separate directory to put the bak.vbs into it, and the mht document will be generated in the current directory. Due to some network reasons, some can not become mht, please check against the url.htm directory list

'=

On Error Resume next

If (lcase (right (wscript.fullname,11)) = "wscript.exe") then

Wscript.echo "Execute it under the cmd.exe Plz! Thx."

Wscript.quit

End if

Const adSaveCreateNotExist = 1

Const adSaveCreateOverWrite = 2

Const adTypeBinary = 1

Const adTypeText = 2

Set args = WScript.Arguments

If args.Count = 0 then

WScript.Echo "Usage: CScript baidublogbak.vbs blogname i n url.htm username password"

WScript.Quit 1

End If

Set objMessage = CreateObject ("CDO.Message")

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

Ie.visible=true

Ie.navigate "http://passport.baidu.com/?login"

Do

Wscript.Sleep 200

Loop Until ie.ReadyState=4

Ie.document.getElementById ("username"). Value=args.Item (4)

Ie.document.getElementById ("password") .value=args.Item (5)

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

Tj.submit

WScript.Sleep 10000

Sub SaveToFile (Msg, Fn)

Dim Strm, Dsk

Set Strm = CreateObject ("ADODB.Stream")

Strm.Type = adTypeText

Strm.Charset = "gb2312"

Strm.Open

Set Dsk = Msg.DataSource

Dsk.SaveToObject Strm, "_ Stream"

Strm.SaveToFile Fn, adSaveCreateOverWrite

End Sub

For n=args.Item (1) To args.Item (2) Step 1

Url= "http://hi.baidu.com/"&args.Item(0)&"/blog/index/"&n

Ie.Navigate url

Ie.visible=false

While ie.Busy

WScript.Sleep 100

Wend

Do

Wscript.Sleep 200

Loop Until ie.ReadyState=4

Wscript.echo "saving page" & n & "page"

Wscript.Sleep 3000

For iTunes 0 To ie.Document.links.length-1

If InStrRev (ie.Document.links (I) .href, "blog/item/",-1dag1) 0 And InStrRev (ie.Document.links (I) .innerText, "browsing",-1jue 1) = 0 And InStrRev (ie.Document.links (I) .href, "# comment",-1jue 1) = 0 And InStrRev (ie.Document.links (I) .href, "cmtid",-1jue 1) = 0then

Wscript.echo ie.Document.links (I) .href & "| | & ie.Document.links (I) .innerText

CreateObject ("Scripting.FileSystemObject") .OpenTextFile (args.Item (3), 8 ie.Document.links TrueLet0) .WriteLine (ie.Document.links (I). Href & "| | & ie.Document.links (I) .innerText)

ObjMessage.CreateMHTMLBody ie.Document.links (I) .href

SaveToFile objMessage, ie.Document.links (I) .innerText & ".mht"

End if

Next

Next

Ie.quit

Set ie=nothing

These are all the contents of this article entitled "how to use the baidublogbak.vbs Code of Baidu Space backup script". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report