1

I'm trying to get a number from a page in a website, but when I do the HTML request, the result is a strange HTML without the informations of the original html that I want.

The website is that: https://www.airbnb.com.br/rooms/31806967?check_in=2022-02-01&guests=10&adults=10&check_out=2022-02-12

The number that I want to get is the price "622" in the right part of the page.

I've already tried this:

Dim html_site As String
Dim html As MSHTML.HTMLDocument
Set html = New MSHTML.HTMLDocument
Link = "https://www.airbnb.com.br/rooms/31806967?check_in=2022-02-01&guests=10&adults=10&check_out=2022-02-12"
    
    With CreateObject("WinHttp.WinHttpRequest.5.1")
        .Open "GET", Link, False
        .setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9"
        .send
        html.body.innerHTML = .responseText
    End With
        
    html_site = html.body.innerHTML

MsgBox html_site

when i try to get the price it falls on an error. I believe this code isn't getting the html source of the page.

  • Did you try the link in IE?. It obvious what is wrong. – KL-1 Jan 31 '22 at 20:27
  • 1
    IE is deprecated and the uninstall by security reasons period has begun, I'd suggest you to start digging into a solution based on [Selenium](https://stackoverflow.com/questions/57216623/using-google-chrome-in-selenium-vba-installation-steps) and use chrome – Sgdva Jan 31 '22 at 22:38

0 Answers0