关于VBS采集,网上流行比较多的方法都是正则,其实 htmlfile 可以解析 html 代码,但如果 designMode 没开启的话,有时候会包安全提示信息。
但是开启 designMode (@预言家晚报 分享的方法) 的话,所有js都不会被执行,只是干干净净的dom文档,所以在逼不得已的情况下开启 designMode 一般情况保持默认即可。

Set html = CreateObject("htmlfile")
Set http = CreateObject("Msxml2.ServerXMLHTTP")

html.designMode = 
"on" ' 开启编辑模式

http.open "GET""http://www.cnblogs.com/"False
http.send
strHtml = http.responseText

html.write strHtml 
' 写入数据
Set post_list = html.getElementById("post_list")
For Each el In post_list.children
    WScript.Echo el.getElementsByTagName(
"a")(0).innerText
Next

vbs 解析 html 文档

其实方法很简单,但是重点是会vbs的,却不一定都会 dom 操作,所以这个很纠结。
我也没办法,只能靠你们自己了,我只是分享一下思路而已、

这样解析 html 比正则方便快捷多了。

相关文章:

  • 2021-07-29
  • 2021-06-22
  • 2022-12-23
  • 2021-08-22
  • 2021-11-30
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-16
  • 2021-10-12
  • 2022-12-23
  • 2022-02-08
  • 2021-09-26
  • 2021-10-19
相关资源
相似解决方案