Hack 100 Working Without the eBay API


Programming eBay outside the confines of the eBay API.

Consider the API to be a gift from the gods at eBay. At least in theory, the existence of the API puts an end to the need for scrapers, parsers, and other kludges.

For example, the script in [Hack #24] retrieves auction information by parsing the title of the auction page. While this works most of the time, it is susceptible to failure from even the smallest changes. Now, consider the alternative script in [Hack #86], which accomplishes the same task with more robust API calls. The API version will continue to work even if eBay dramatically changes the formatting of their auction pages (which, in fact, they did on July 7, 2003).

But the API comes at a cost. Quite a bit of setup is required (not to mention certification) before you can use the API, and it often ends up being somewhat slower than some simple parsers.

So here are some extra, non-API tools you can use to supplement (or take the place of) your API-based code.

Note that all of these come with the standard "don't do this" clause. Not only are these types of tools unreliable by their very nature, but they also violate eBay policies.

  • WWW::Search::eBay. This Perl module, written by Glenn Wood and available at search.cpan.org/perldoc?WWW::Search::eBay, scrapes eBay search pages and returns the results. See [Hack #17] for a working example. Note that updated versions can also be found at alumni.caltech.edu/~glenwood/SOFTWARE/.

  • php eBay List. This PHP script, available at www.aeoninteractive.net, parses your About Me page to obtain a list of your currently running auctions, which you can then list on your own site. See [Hack #78] for the official way to do this (and make money to boot).

  • grep. This little Perl function (also a program found on any Unix system) allows you to search text or a file for a particular string of characters. If you download any page from eBay.com using lwp-download, you can build your own scraper with grep in just a few lines of code.