Option Explicit
Dim WithEvents ie As InternetExplorer
Private Sub Form_Load()
Set ie = New InternetExplorer
ie.Navigate2 "http://list.mp3.baidu.com/list/newhits.html"
End Sub
Private Sub ie_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
If URL = "http://list.mp3.baidu.com/list/iframe.html" Then
Dim i As Long, j As Long
Dim strText As String, strRows() As String, strFields() As String
strText = ie.Document.getElementsByTagName("TABLE")(3).innerText
strText = Replace(strText, vbCrLf, "")
strText = Replace(strText, ".", " ")
strText = Replace(strText, "(", "")
strRows = Split(strText, ")")
Debug.Print "序号", "歌名", "作者"
For i = 0 To UBound(strRows) - 1
strFields = Split(strRows(i), " ")
For j = 0 To 2
Debug.Print strFields(0), strFields(1), strFields(2)
Next
Next
ie.Quit
End If
End Sub
VB获取网页源码,发贴不易,请别删谢谢!
最新推荐文章于 2021-06-05 07:54:49 发布