E-Bay scrape of completed items sold for a specified search

JAnders

New Member
Joined
Feb 27, 2015
Messages
37
Hello,
I'm having a heck of a time trying figure out how to extract the data I'm needing. I'm rather new to VBA and trying to read / watch many scraping videos and I'm not getting the output I'm looking for.
Ultimately I would like to have a table pulled from a completed /sold search from ebay

The following URL has a pre-filtered search criteria (excluding the "XXXXX" which I want to pull from the value on Worksheets("Sheet1").Range("A1")
https://www.ebay.com/sch/i.html?_from=R40&_nkw="XXXXX"&_sacat=0&rt=nc&LH_Sold=1&LH_Complete=1&_ipg=200

Starting on
Worksheets("Sheet1") Row 6 I would like each column to list the following (up through the 200 that are shown, if could cycle through the first 5 pages (1000) that would be an ultimate value add!)

Column A = Title of Item that was sold (I believe is labeled S_item_title)
Column B
= Amount it was sold for (I believe is labeled S_item_price)
Column C = Total Bids
(I believe is labeled S_item_bidCount)
Column D = Date Sold
(I believe is labeled S_item_endeddate)
Column E = Date Sold (I believe is labeled S_item_logisticscost)

Many appreciations, I know I'm basically asking for to be written from scratch, I've tried to pick apart other examples and am having no luck applying to my needs.

Cheers-
 
Last edited:

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I've attempted this code, which was taken edited from the following website.
It seems to communicate, however I'm not extracting any of the data. For simplicity, I'm just trying to put the the name of the product on column A and the price of the product on column B. I can edit from there once I figure out how to get the data onto excel. Overall, I'm lost...



Sub useClassnames()
Dim element As IHTMLElement
Dim elements As IHTMLElementCollection
Dim ie As InternetExplorer


Dim html As HTMLDocument


'open Internet Explorer in memory, and go to website


Set ie = New InternetExplorer


ie.Visible = True


ie.navigate "https://www.ebay.com/sch/i.html?_from=R40&_nkw=find+item&_sacat=0&LH_TitleDesc=0&LH_Complete=1&LH_Sold=1&_ipg=200"
'Wait until IE has loaded the web page


Do While ie.readyState <> READYSTATE_COMPLETE


Application.StatusBar = "Loading Web page …"


DoEvents


Loop


Set html = ie.document


Set elements = html.getElementsByClassName(“S - item”)


Dim count As Long
Dim erow As Long
count = 0
For Each element In elements
If element.className = “S - item” Then


erow = Sheet1.Cells(Rows.count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1) = html.getElementsByTagName(“h3”)(count).innerText
Cells(erow, 2) = html.getElementsByClassName(“S - item_price”)(count).innerText
count = count + 1
End If
Next element
Range("A2:B201").Select
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").ColumnWidth = 36
MsgBox count



End Sub
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top