peskywinnets
Registered User.
- Local time
- Today, 10:24
- Joined
- Feb 4, 2014
- Messages
- 578
So I seek to have VBA go fetch an amazon product listing & extract the bit of text that tells me if Amazon themselves are the seller of the product.
I found this ...
https://www.wiseowl.co.uk/blog/s393/scrape-website-html.htm
...which is a great start/primer, but I'm still struggling!
I wish to pull in a bit of data from a webpage that would look like this...
https://www.amazon.co.uk/dp/B001KOTNG2
specifically the bit of text that says "Dispatched from and sold by Amazon"
So here's what I've got...
The bit that's bolded seems to work, but it's the parsing of the returned data that I'm struggling with.
hen I view the Amazon's webpage source code, the data I seek seems to be underneath this section/element...
<div id="merchant-info" class="a-section a-spacing-mini">
...I realise this is probably a big ask, but my brain a bit fogged - can anyone lend a helping hand (it's likely to be a quick fix for those that are bit tidy with parsing data in VBA! - I'm not!)
I found this ...
https://www.wiseowl.co.uk/blog/s393/scrape-website-html.htm
...which is a great start/primer, but I'm still struggling!
I wish to pull in a bit of data from a webpage that would look like this...
https://www.amazon.co.uk/dp/B001KOTNG2
specifically the bit of text that says "Dispatched from and sold by Amazon"
So here's what I've got...
Code:
[B]Sub ImportAmazonProductData()
Dim ie As InternetExplorer
Dim html As HTMLDocument
Set ie = New InternetExplorer
ie.Visible = False
ie.navigate "https://www.amazon.co.uk/dp/B001KOTNG2"
Do While ie.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
Set html = ie.Document
Set ie = Nothing
[/B]
' this is the parsing bit (fail!)....
Set SoldBySection = html.getElementById("merchant-info")
Set SoldBy = SoldBySection.Children
For Each Seller In SoldBy
Debug.Print Seller
Next
End Sub
The bit that's bolded seems to work, but it's the parsing of the returned data that I'm struggling with.
hen I view the Amazon's webpage source code, the data I seek seems to be underneath this section/element...
<div id="merchant-info" class="a-section a-spacing-mini">
...I realise this is probably a big ask, but my brain a bit fogged - can anyone lend a helping hand (it's likely to be a quick fix for those that are bit tidy with parsing data in VBA! - I'm not!)