diddi
Well-known Member
- Joined
- May 20, 2004
- Messages
- 3,337
- Office Version
- 2010
- Platform
- Windows
Hi all. I have a scrape which works fine with the exception that i cannot work out how to capture the href data following "<a class="list__link" href=" in the html.
My sub:
sample tablerow html:
My sub:
VBA Code:
Sub ScrapeNow()
Dim xmlhttp As XMLHTTP60
Dim oDom As Object: Set oDom = CreateObject("htmlFile")
Set xmlhttp = New MSXML2.ServerXMLHTTP60
Dim objXML As MSXML2.DOMDocument60 'MSXML2.DOMDocument
Dim ele As IHTMLElement
Set objXML = New MSXML2.DOMDocument60
prow = 2
For row = 65 To 90
For row2 = 1 To 100
MyURL = "https://www.scenicrim.qld.gov.au/council-services/cemeteries/interment-database?itemsPerPage_356=1000&search_356_30=" & Chr(row) & "&search_356_3=&submit_356=FIND&page_356=" & row2
Label1.Caption = "Waiting for " & Chr(row) & " Page " & row2
DoEvents
With xmlhttp
.Open "GET", MyURL, False
.send
oDom.body.innerHTML = .responseText
If InStr(.responseText, "no content available") > 0 Then Exit For
End With
With oDom.getElementsByTagName("table")(0)
For Each oRow In .Rows
prow = prow + 1
col = 0
oDom.getElementsByClassName ("list__link")
For Each oCell In oRow.Cells
col = col + 1
Cells(prow, col) = oCell.innerText
Next oCell
Next oRow
End With
Next row2
Next row
End Sub
sample tablerow html:
Rich (BB code):
<tr>
<td scope="row">1</td>
<td scope="row">
<a class="list__link" href="/directory-record/14156/aagaard-doris-susan">Aagaard</a> ' i want this link here
</td>
<td scope="row">
Doris Susan
</td>
<td scope="row">
Mount Tamborine
</td>
<td scope="row">
31 July 1980
</td>
<td scope="row">
29 July 1980
</td>
</tr>