|
渔来了
- Sub t()
- Dim Url As String, i As Long, j As Integer, m As Integer
- Dim mybook As String, objh As Object, db As Object
- Set objh = CreateObject("htmlfile")
- mybook = "钢琴传奇"
- Url = "http://search.dangdang.com/?key=" & Trim(mybook)
- With CreateObject("msxml2.xmlhttp")
- .Open "GET", Url, False
- .send
- objh.body.innerhtml = .responsetext
- Set db = objh.all.tags("li")
- End With
- For i = 0 To db.Length - 1
- If db(i).className = "line1" Then
- Stop
- m = m + 1
- For j = 0 To db(i).ChildNodes.Length - 1
- Debug.Print j & ">--->" & db(i).ChildNodes(j).innerhtml
- Cells(m, 1) = db(i).ChildNodes(2).innertext '书名
- Cells(m, 2) = db(i).ChildNodes(4).ChildNodes(0).innertext '售价
- Cells(m, 3) = db(i).ChildNodes(4).ChildNodes(1).innertext '原价
- Cells(m, 4) = db(i).ChildNodes(4).ChildNodes(2).innertext '折扣
- Next j
- End If
- Next i
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|