Advertisement
omegastripes

AMAZON FETCHER V.03.1.xlsm ~ MAIN module

Apr 7th, 2020
1,092
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Sub AMAZONMAIN()
  4.    
  5.     Dim img As MSHTML.IHTMLElement
  6.     Dim req As New MSXML2.XMLHTTP60
  7.     Dim doc As New MSHTML.HTMLDocument
  8.     Dim linkList As Range, r As Range
  9.     Dim link As String
  10.     Set linkList = Sheet1.Range("A3", Range("A3").End(xlDown))
  11.     For Each r In linkList
  12.         link = r.Value
  13.         req.Open "GET", link, True
  14.         req.send
  15.         Do While req.readyState <> 4
  16.             DoEvents
  17.         Loop
  18.         Dim resp
  19.         resp = req.responseText
  20.         doc.body.innerHTML = resp
  21. '        Debug.Print Req.responseText
  22.        On Error Resume Next
  23.         r.Offset(0, 1).Value = doc.getElementById("productTitle").innerText
  24.         r.Offset(0, 2).Value = doc.getElementById("feature-bullets").innerText
  25.         r.Offset(0, 3).Value = doc.getElementById("productDescription").innerText    '
  26.        r.Offset(0, 4).Value = doc.getElementById("priceblock_ourprice").innerText
  27.         r.Offset(0, 5).Value = doc.getElementById("ourprice_shippingmessage").innerText
  28.         r.Offset(0, 6).Value = doc.getElementById("SalesRank").innerText
  29.         Dim a
  30.         a = Split(resp, """hiRes"":""https")
  31.         Dim i
  32.         For i = 1 To UBound(a)
  33.             r.Offset(0, 6 + i).Value = "https" & Split(a(i), """", 2)(0)
  34.         Next
  35.     Next r
  36.     MsgBox "DATA FETCHED SUCCESSFULL BOSS"
  37.    
  38. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement