O'Reilly logo

eBay Hacks, 2nd Edition by David A. Karp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #111. Track Items in Your Watching List

Link an off-eBay auction tracker with eBay's Items I'm Watching list.

eBay provides the Items I'm Watching list (in My eBay Bidding/Watching) to help you keep track of auctions on which you haven't yet bid. A corresponding API call, GetWatchList, allows you to access the contents of that list.

But the Items I'm Watching list is rather limited and can be replaced with a custom tracking list [Hack #29] . Although the hack works, there are two simple ways to use the eBay API to make the script more robust and efficient:

  • Retrieve the title and end date with the GetItem API call instead of using the flakier method of extracting them from the auction page title.

  • Supplement the tracking list with any auctions in the Items I'm Watching list.

The following is a revised auction-tracking script with both of these improvements.

Tip

This script requires all the Perl modules specified in "Keep Track of Auctions Outside of eBay" [Hack #29] , as well as Time::Local, by Tom Christiansen, Graham Barr, and Dave Rolsky (search.cpan.org/perldoc?Time::Local), which is used to convert dates retrieved from the API from GMT to local time.

	#!/usr/bin/perl
	require 'ebay.pl';
	use Time::ParseDate;
	use Time::Local;
	use POSIX qw(strftime);
	require 'cgi-lib.pl';

	&ReadParse;
	$selfurl = "http://www.ebayhacks.com/exec/track.pl";
	$localfile = "ebay list.txt"; $timeoffset = 0; @formatting=("color=#EE0000 STYLE=font-weight:bold", "color=#000000 STYLE=font-weight:bold", "color=#000000"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required