Contents
Instructions
Create an ASP page, inserting the ASP code below at the very
start of the page. You will need to create a database table to hold the
results (see below) and enter a valid connection string in the variable
indicated.
Insert the HTML code below between the <body> tags of
your ASP page. To use the page run a search as normal, then paste the
source code into the large box on the page and click submit.
Use the SQL code to create queries in your database which aggregate
the data you have extracted.
Please note the following:
- No warranties or guarantees are offered for this code. It has been
tested and used by us, but your system settings, eBay changes, and
other factors may stop it working for you.
- You use this code at your own risk. We are not responsible for any
damage or complaint arising from its use.
- You may freely use and adapt this code for any purpose, as you see
fit. Please credit this site if you do so.
ASP Code
Dim strResponse, Match, Matches, strOutPut, intCategory
Dim intItemCount, x, strSQL, con, strDBConnection, reItem
Dim intMaxItems
strDBConnection = "ENTER YOUR CONNECTION STRING HERE"
If Request.Form <> "" Then
intCategory = CLng(Request.Form("cat"))
strResponse = Request.Form("text")
intMaxItems = CInt( "0" & Request.Form("max"))
If intMaxItems = 0 Then intMaxItems = 100
Set reItem = New RegExp
reItem.Global = True
reItem.IgnoreCase = True
reItem.Pattern = "dSI\([01]\,[01]\,[01]\,[01]\,[01]\," & _
"[01]\,[01]\,[01]\,[01]\,[01]\,[01]\,(\d{1,3})\,(\d" & _
"{10})\,""([^""]{1,50})[^\$]*\$([\d\.]*)"
Set con = Server.CreateObject("ADODB.Connection")
con.Open strDBConnection
Set Matches = reItem.Execute(strResponse)
For Each Match in Matches
strOutPut = strOutPut & reItem.Replace(Match.Value, _
"<tr> <td>$1</td> <td>$2</td> <td>$3</td> <td>" & _
"$4</td> </tr>" & vbNewLine)
strSQL = reItem.Replace(Match.Value, "INSERT INTO" & _
"tblEbayItems (TopCatID, eBayItemID, ItemTitle," & _
" Price, Bids) VALUES (" & intCategory & ", '$2" & _
"', '$3', $4, $1);")
con.Execute strSQL
intItemCount = intItemCount + 1
If intItemCount >= intMaxItems Then Exit For
Next
con.Close
Set con = Nothing
End If
%>
HTML Code
<form action="" method="post" name="form"> <p>Category: <select name="cat"> <option value="20081" selected>Antiques</option> <option value="550">Art</option> <option value="267">Books</option> <option value="12576">Business & Industrial</option> <option value="11450">Clothing, Shoes & Accessories</option> <option value="11116">Coins</option> <option value="1">Collectibles</option> <option value="293">Computers & Electronics</option> <option value="237">Dolls & Bears</option> <option value="45099">Entertainment</option> <option value="11700">Home</option> <option value="281">Jewelry & Watches</option> <option value="619">Musical Instruments</option> <option value="870">Pottery & Glass</option> <option value="888">Sports</option> <option value="260">Stamps</option> <option value="220">Toys & Hobbies</option> <option value="99">Everything Else</option> </select> Category Number = <%=intCategory%> </p> <p>Max Items: <input name="max" type="text"
value="<%=intMaxItems%>" size="5" maxlength="5"></p> <p>Items Retrieved: <%=intItemCount%></p> <p><input type="submit" name="Submit" value="Submit"></p> <p><textarea name="text" cols="100" rows="25" wrap="virtual">
<%=strResponse%></textarea></p> </form> <table> <tr> <td>BIDS</td> <td>EBAY NO</td> <td>ITEM NAME</td> <td>PRICE</td> </tr> <%=strOutPut%> </table>
SQL Code
This counts the number of items which received different bid
volumes from zero upwards:
SELECT Bids, COUNT(ItemID) AS BidCount
FROM tblEbayItems
GROUP BY Bids
ORDER BY Bids
|