I am trying to get the pictures links from a searched link through google and this is my try
Sub Test() Const sURL As String = "https://www.google.com.eg/search?q=baby&sxsrf=ALeKk01tyfvvxyYjaC0YctjxaY0RlvPnuw:1586804351129&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjB77TtiuboAhUl5uAKHR5KA2wQ_AUoAXoECBQQAw&biw=1280&bih=881" Dim http As MSXML2.XMLHTTP60, html As MSHTML.HTMLDocument Set http = New MSXML2.XMLHTTP60 Set html = New MSHTML.HTMLDocument With http .Open "Get", sURL, False .send html.body.innerHTML = .responseText End With Dim post As Object, i As Long Set post = html.querySelectorAll(".mM5pbd .bRMDJf") For i = 0 To post.Length - 1 Debug.Print post.Item(i).innerHTML Next i Stop End Sub
First I got the post.Length only 20 while I expect about 300
Second I can’t get the correct link for the picture as it seems it is base64 encrypted or something similar (I am not sure)
How can I get the real links for the picture and get all the links for all the pictures related?
I think it is solved for one point
Set post = html.querySelectorAll("a.VFACy.kGQAp") For i = 0 To post.Length - 1 Debug.Print post.Item(i).href Next i
But how to get all the links instead of the 20 links only?
** The links are not totally right, for example I got this link
While the correct link is