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:

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

JAnders

New Member
Joined
Feb 27, 2015
Messages
37
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
 

Forum statistics

Threads
1,089,431
Messages
5,408,179
Members
403,188
Latest member
Sanjana Ramesh

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top