抓取在 VBA 中无限滚动的网站

时间:2021-01-16 12:56:45

标签: excel vba screen-scraping

我遇到了一个网站,在导航到该网站时会出现无限滚动。这意味着当您手动向下滚动并且没有任何点击时,网页会自动加载.. 这是我的尝试

Sub Test()
    With CreateObject("InternetExplorer.Application")
        .Visible = True
        .Navigate "https://shopee.com.my/shop/145423/followers/?__classic__=1"
        Do: DoEvents: Loop While .Busy Or .readyState <> 4
        Dim html As Object
        Set html = .document
        Dim elemRect As IHTMLRect: Set elemRect = html.querySelector(".loading-text") 'myDiv.getBoundingClientRect
    Do Until elemRect.bottom > 0
        .ParentWindow.scrollBy 0, 10000
        Set elemRect = html.querySelector(".loading-text")
    Loop
    End With
End Sub

我需要知道是否可以抓取此类网页,如果可以,如何控制此过程?

0 个答案:

没有答案