• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Scraper unable to fetch a tag from a webpage

shahin

Active Member
Hi everyone, good day! Even after trying a lot I'm unable to parse a tag from a webpage. Either there is something in the html element of that page I can't notice or there is anything I'm doing wrong with my code. Hope somebody out there will take a look into it and point out the mistake I'm making. Thanks in advance. Here is what I'm trying with.

Code:
Sub WhitePage()
Const URL = "https://www.whitepages.com.au/business/results?name=Split%20Cafe%20%26%20Espresso%20Bar&location=NSW&expand=true"
Dim topics As Object, post As Object

With CreateObject("MSXML2.XMLHTTP")
    .Open "GET", URL, False
    .setRequestHeader "Content-Type", "text/xml"
    .setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1)"
    .send
    Set html = CreateObject("htmlfile")
    html.body.innerHTML = .responseText
End With
Set topics = html.getElementsByTagName("a")
For Each post In topics
    x = x + 1
    Cells(x, 1) = post.innerText
Next post
Set html = Nothing: Set topics = Nothing
End Sub
 
Thanks sir Chihiro. I just saw it with the developer tools. Things are getting harder with the passage of time.
 
Back
Top