Use eBay's auction-tracking tools or create a flexible auction-watching tool better than anything eBay has to offer.
If I bought everything on eBay I wanted, I would've gone broke long ago. But I'm also a collector, and as such, I routinely track many auctions in my various fields of interest, whether or not I actually intend to bid on them.
Keeping track of auctions is among your most important tasks as a bidder—especially for items you've won—if for no other reason than to ensure that you eventually receive everything you've paid for. Tracking auctions is also an essential part of sniping [Hack #26] as well as selling [Hack #43] . If you're really after something specific, you may want to track completed auctions that didn't sell, so you can find them easily when they're relisted. And sometimes you may want to keep track of an auction's progress purely for the sake of curiosity.
The All Buying section of My eBay is where most people turn to track their auctions. The Items I'm Bidding On, Items I've Won, and Items I Didn't Win lists are all updated automatically whenever you place a bid or an auction on which you've bid closes, respectively. These lists include all the vitals, such as the auction titles, amounts of your bids, end dates, and closing prices.
By default, the Items I've Won and Items I Didn't Win lists show only auctions that have ended in the past few days, but you can increase their range to up to 60 days by typing the desired number of days in the box at the top of each list. And like search results, all the lists on this page can be sorted by clicking the hyperlinked column headers.
You can clean out these lists by ticking the checkboxes next to one or more auction titles and clicking Remove. However, when you delete an auction, its entry disappears into the ether with no obvious means of retrieval. (The only way to retrieve a deleted listing for items you've won is to retrieve them all; go to My eBay → eBay Preferences, turn on the "Retrieve removed items" checkbox in the "My eBay Preferences," and click Apply.) A better way to shorten these lists is to simply decrease the number of days back they go.
The Items I'm Watching list is a very handy tool, but it works somewhat differently than the others. It will remain empty until you choose to "watch" an auction: simply go to any auction (or fixed-price listing) page and click "Watch this item." A message then appears, confirming that item is now being tracked in My eBay; click the link to view the updated list. The Watching list is easy to use and adequate if you never track more than a few items at a time.
To have eBay send you an automatic Item Watch Reminder email for any item in your Watch list that will end within 36 hours, go to My eBay → Preferences → Notification preferences, and turn on the "Send me daily lists of all items in my watch list that will end within 36 hours" option.
The eBay toolbar [Hack #23] sports a few additional features that work in conjunction with the Items I'm Watching list, such as watch alerts and bid alerts that remind you when auctions you're watching or have bid on are about to end.
As useful as eBay's tools are, you may find that none of them completely meet your needs. For example:
You can watch a maximum of 100 listings at a time. When you reach the limit, you have to manually delete watched items before you can add more.
Completed listings remain in the lists for no longer than 60 days, even though they often remain in the eBay system for about 5 months.
You can't add listings to your Watching list after they've ended, which would be useful if you're a bidder waiting for the seller to relist, or you're selling something similar yourself.
There's no way to prioritize items in your Watching list, which would be useful for differentiating items on which you're planning to bid and those about which you're simply curious.
The Bidding/Watching page can be cumbersome to use. For example, the way entries are divided into auctions won, auctions lost, etc., has a certain logic to it, but doesn't necessarily end up being as convenient as a single, unified list of auctions.
These limitations have prompted me to come up with something better: a fully customizable, web-based, off-site list of auctions with none of the limitations of eBay's tools. The following hack is based on a tool I created for my own use and have used every day since. There are two parts to this hack: the Perl script, used to store and display your personal list of auctions; and the link, used to activate the script and add the currently displayed auction.
The first task is to create an easy way to add any given auction to your custom list, an alternative to the Watch This Item link on auction pages. This is accomplished by placing the following snippet of JavaScript in a button on your browser's Links bar [Hack #14] :
javascript:void(win=window.open('http://www.ebayhacks.com/exec/track.pl? do=add&auction='+location.href+'&title='+document.title,'Hack'))
(Make sure the text appears all on one line.) You can name the new link anything you like, such as Watch Auction or simply Track.
The first few bits of the code are used to instruct your browser
to open a new browser window and execute the code inside the
parentheses, but it's the stuff that follows that's the most
interesting. First comes the complete URL of your tracking tool, so
you'll need to change www.ebayhacks.com
to the name of your own web server, /exec
to the name of your executable folder
(usually /cgibin
), and track.pl
to the filename of your script
(discussed in the following section). The second half of the URL—the
text after the question mark (?
)—is
composed of three arguments that are passed to your script, separated
by ampersands (&
):
do=add&auction='+location.href+'&title='+document.title
The JavaScript code automatically inserts the auction URL
(location.href
) and page title
(document.title
) as arguments to
pass to the script. One of the neat little tricks of this code is how
it works with eBay's auction URL, which also includes arguments
separated by ampersands:
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=3125058177
When this URL is passed to your script with the other arguments, it is automatically split into these two arguments:
auction=http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem item=3125058177
and thus the auction number is conveniently separated for you!
The second half of this hack is a Perl script that interprets the information it receives from the JavaScript link (see the previous section), stores all your auctions in a file, and then displays a properly sorted list.
#!/usr/bin/perl # *** includes *** use Time::ParseDate; use POSIX qw(strftime); use LWP 5.64; use HTML::HeadParser; require("cgi-lib.pl"); &ReadParse; # *** variables ***$selfurl = "http://www.ebayhacks.com/exec/track.pl"; $localfile = "/usr/local/home/ebaylist.txt"; $timeoffset = 0; $url = "http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=";
@formatting=("color=#EE0000 STYLE=font-weight:bold", "color=#000000 STYLE=font-weight:bold", "color=#000000"); $i = 0; $exists = 0;
$numlevels = 2; # *** read stored list *** open (INFILE,"$localfile"); while ( $line = <INFILE> ) { $line =~ s/\s+$//; $i++; ($enddate[$i],$priority[$i],$item[$i],$title[$i]) = split(",", $line, 4); # *** see if passed auction number is in list already *** if (($item[$i] ne "") && ($item[$i] eq $in{'item'})) { $exists = $i; } } close (INFILE); # *** add latest auction to list, if valid *** if (($in{'auction'} =~ "ebay.com") && ($in{'item'} != "") && ($exists==0)) { $x = index($in{'title'}, "("); $y = index($in{'title'}, ")", $x); $z = index($in{'title'}, "-", $y);
$title = &get_title($in{'item'}); $enddate = parsedate(substr($in{'title'}, $x + 6, $y - $x - 7)); $i++; ($enddate[$i], $priority[$i], $item[$i], $title[$i]) = ($enddate, 2, $in{'item'}, $title); } elsif (($in{'do'} eq "promote")) { $priority[$exists]--; if ($priority[$exists] < 0) { $priority[$exists] = 0; } } elsif (($in{'do'} eq "demote")) { $priority[$exists]++; if ($priority[$exists] > 2) { $priority[$exists] = 2; } } elsif (($in{'do'} eq "delete")) { splice @enddate, $exists, 1; splice @priority, $exists, 1; splice @item, $exists, 1; splice @title, $exists, 1; $i--; } # *** update list *** if (($in{'do'} ne "")) { open (OUTFILE,">$localfile"); for ($j = 1; $j <= $i; $j++) { print OUTFILE "$enddate[$j],$priority[$j],$item[$j],$title[$j]\n"; } close (OUTFILE); print "Location: $selfurl\n\n"; exit( 0); } # *** sort list *** @idx = sort criteria 0 .. $i; # *** display list *** print "Content-type: text/html\n\n"; print "<table border cellspacing=0 cellpadding=6>\n"; for ($j = 1; $j <= $i; $j++) { $formatteddate = strftime("%a, %b %d - %l:%M:%S %p", localtime($enddate[$idx[$j]]));
$formattedtitle = "<a href=\"$url$item[$idx[$j]]\" target=\"_blank\"><font $formatting[$priority[$idx[$j]]]>$title[$idx[$j]]</font></a>"; if (strftime("%v", localtime($enddate[$idx[$j]])) eq strftime("%v", localtime(time))) {
$formattedtitle = "<li>" . $formattedtitle; } if ($enddate[$idx[$j]] < time) {
$formattedtitle = "<strike>" . $formattedtitle . "</strike>"; } else { $timeleft = ($enddate[$idx[$j]] - time) / 60 + ($timeoffset * 60); if ($timeleft < 24 * 60) { $hoursleft = int($timeleft / 60); $minleft = int($timeleft - ($hoursleft * 60)); if ($minleft < 10) { $minleft = "0" . $minleft; }
$formattedtitle = $formattedtitle . " <font size=-1>($hoursleft:$minleft left)</font>"; } } print "<tr><td>$formattedtitle</td>"; print "<td><font size=-1>$formatteddate</font></td>";
print "<td><a href=\"$selfurl?item=$item[$idx[$j]]&do=promote\">+</a>"; print " | <a href=\"$selfurl?item=$item[$idx[$j]]&do=demote\">-</a>"; print " | <a href=\"$selfurl?item=$item[$idx[$j]]&do=delete\">x</a></td>"; print "</tr>\n"; } print "</table>\n"; sub criteria { # *** sorting criteria subroutine *** return ($priority[$a] <=> $priority[$b] or $enddate[$a] <=> $enddate[$b]) } sub get_title($) { my $itempage = LWP::UserAgent -> new; my $item_contents = $itempage -> get($_[0]); my $p = HTML::HeadParser -> new; $p -> parse($item_contents -> content); $title = $p -> header('Title'); $title = substr($title, index($title, " - ") + 3); return $title; }
This script requires the Time::ParseDate
Perl module, part of David
Muir Sharnoff's Time-modules-2003.0211
distribution
(search.cpan.org/perldoc?Time::ParseDate),
which is necessary to convert eBay's date notation into something
Perl understands.(See the "Installing Perl Modules" sidebar in the
Preface for installation instructions.) Also required is Steven E.
Brenner's cgi-lib.pl Perl library
(cgi-lib.berkeley.edu), which is used to parse
the arguments passed from the JavaScript link, and the LWP
and HTML::HeadParser
Perl modules, which are
used to retrieve the auction title from the listing page.
Save this script as track.pl and place it
in your web server's cgi-bin directory, as
described in the Preface. Note that the $selfurl
and $localfile
variables must be modified to match the URL of your
script and the location of the local file in which the auction titles
are to be stored, respectively. Also, you may need to adjust
the
$timeoffset
variable to
compensate for the time zone difference between eBay time (Pacific
time) and your computer's clock; e.g., enter 3
if you're in eastern time
(GMT–5:00).
With the script in place and the JavaScript link at the ready on your browser toolbar, all that's left is to try it out. Open any auction page on eBay and click the Track link on your Links bar. A new window will open, and the auction you were just looking at will appear at the top of the list, as shown in Figure 3-3. Repeat this for as many auctions as you like; there's virtually no limit. You can even track completed auctions and auctions that you haven't won.
Click the title of any auction to open the eBay listing page in
a new window. Click the x
link to
delete the entry.
Auctions can be prioritized; all new entries start out at the lowest priority and are shown in normal font. Click the + link to promote an auction and make its title bold. Click + again to promote the auction to the highest level and make its title red and bold. Likewise, click - to demote any entry. Higher-priority items appear higher in the list, and all auctions within a certain priority level are sorted by their closing date. I use the lowest priority for auctions on which I don't intend to bid, the medium priority for items I want, and the highest priority for items I've already bid on and won.
Sellers often lower [Hack #65] the Buy It Now prices [Hack #31] of running auctions that haven't received bids, sometimes repeatedly. If you really want an item, it's a good idea to check back a few times before the end of the auction to see if you can snag it before someone else does.
As with all the hacks in this book, you can download the code for this hack at ebayhacks.com.
Naturally, you'll want to customize this hack to suit your needs, which is really this tool's greatest advantage over eBay's Bidding/Watching page. Among the more interesting ways to hack this script are the following:
If you're familiar with HTML, you can add pictures and text to
your heart's content. Add shading and even column headers (for
sorting) to the table. Replace the +, −, and x links
with more interesting icons, and add a splash
of color to the page.
You can have as many different levels of prioritization as you
like. Three levels suit my needs just fine, but you can add more by
increasing the $numlevels
variable .(Keep in mind that lower numbers mean a
higher priority.) The only other thing you'll need to maintain is
the
@formatting
array
, which contains snippets of HTML code [Hack
#52] (one for each priority level) that visually
differentiate one priority level from another.
Using the $item[$idx[$j]]
variable , you can also add links to bid, leave
feedback, and view the bid history.
To support multiple users, include another argument in the
JavaScript link (Part 1), such as &user=cletus
. Then, simply append the
username to the filename to create a different auction list file for each user, like this:
$localfile = "/usr/local/home/ebaylist_\L$in{'user'}.txt";
Thus, the script will load the file appropriate to the specified username (in this case, cletus.txt).
The script contains code that adds a little "richness" to the
tool. For example, completed auctions have crossed-out titles
, auction sending today are marked with round
bullets
, and any auction ending within 24 hours shows
the time left to bid
. I've found these additions to be quite
helpful for my purposes, but you may have different needs. For
example, if you're in front of your computer only during the day,
you can configure the script to highlight auctions ending after 5:00
p.m. so you know you'll have to bid early or set up an automatic
snipe [Hack #27] .
The script retrieves the auction title by using the
&get_title
subroutine defined at the
end of the script. This routine loads the page and then grabs the
listing title, which can be time-consuming. To speed up the script,
you can extract the auction title from the URL passed by the
JavaScript link by replacing line with this code:
$title = substr($in{'title'}, $z + 2);
The caveat to this approach is that if the title contains an
ampersand (&
) or pound sign
(#
), the title will be broken
apart, and all you'll get is the first portion. Also, the script
determines the closing time and date by further parsing the title,
and may not work with titles from non-U.S. sites that use a
different date notation.
A more bulletproof (and only slightly more complex) solution to both of these problems would be to use the eBay API to retrieve the auction title and end date [Hack #111] . This would also enable you to reliably read the seller's name, the current price, and other auction details, all without having to resort to parsing.
The pop-up window can be customized by modifying the JavaScript code. For example, add the following to the JavaScript line:
,'width=400,height=300,menubar=no,status=no,resizable=yes,scrollbars=yes'
to assign a fixed size to the pop-up window. Make sure to
place the code after 'Hack' but before the two closing parentheses,
and to include the comma and enclose the parameters as a whole in
single quotes as shown. More information on these parameters can be
found in any JavaScript documentation, under the window.open
statement.