Web DevCenter
oreilly.comSafari Books Online.Conferences.
MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA

Sponsored Developer Resources

Web Columns
Adobe GoLive
Essential JavaScript
Megnut

Web Topics
All Articles
Browsers
ColdFusion
CSS
Database
Flash
Graphics
HTML/XHTML/DHTML
Scripting Languages
Tools
Weblogs

Atom 1.0 Feed RSS 1.0 Feed RSS 2.0 Feed

Learning Lab






O'Reilly Book Excerpts: eBay Hacks

Hacking eBay

Related Reading

eBay Hacks
100 Industrial-Strength Tips & Tools
By David A. Karp

by David A. Karp

Editor's note: This week we're showcasing excerpts from the recently released eBay Hacks. These three hacks have a common thread--they all deal in some manner with hacking the view of eBay from your browser. In the first hack, tap into eBay's massive database right from your own address bar; in the second, learn how to use Cascading Style Sheets to change the look of your eBay page; and in the third, find out how to control the view of other eBayers' pages with your own browser. If you enjoyed these hacks, you'll find 97 more such tips and tricks in the book.

Hack #12. Tweaking Search URLs

Tap into eBay's massive database right from your own address bar.

eBay is essentially a massive database. Every time you view an auction page, you're just looking at a single database record. Every time you search, you're performing a query. But even if you're not familiar with DB lingo, you can play with eBay's URLs to tweak what you see.

Auction Pages

Many pages on eBay use a standard CGI (Common Gateway Interface) format, which is nothing more than a program name followed by a command and one or more parameters:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=3128013703

Here, cgi.ebay.com is the name of the server, eBayISAPI.dll is the filename of the program, ViewItem is the command to execute, and item=3128013703 is a parameter. Any additional parameters are separated by ampersands (&).

In this case, 3128013703 is the auction number. Simply replace this with another valid auction number, press Enter, and you'll see the corresponding auction page. This is typically quicker and more convenient than using the Search page to open an auction by its number.

TIP: Some sellers reference other auctions by simply including the auction number in their descriptions, usually because they don't know how to make links (see Hack #40). To view the auction by its number, simply copy and paste the number into the URL, replacing the one that's there.

Search Pages

A typical search page URL looks something like this:

http://search.ebay.com/ws/search/SaleSearch?satitle=avocado+green

Here, I searched for "avocado green", which you can see in the parameter satitle=avocado+green. Most searches will probably have more parameters, some more self-descriptive than others.

The real value in tweaking the URL is the ability to add or change options otherwise unavailable or inconveniently located in the search interface. One of the most useful of these is the self-evident sorecordsperpage option. Although you can choose this option by going to Search → Advanced Search → Results Per Page, this can be cumbersome, and you can't add it to an existing search you've already built. Instead, simply type the following at the end of an existing search URL:

&sorecordsperpage=100

Note the required ampersand (&) to separate this parameter from the one that precedes it. (In the old days, you could have up to 200 items on a page, but eBay has since reduced the limit to 100; anything higher will simply be ignored.) Here are some of the other parameters that are worth typing:

Parameter

Description

&sorecordsperpage=number

Number of search results to show per page, max=100

&sapricelo=price

Show only auctions above or equal to a certain price

&sapricehi=price

Show only auctions below or equal to a certain price

&sacategory=num+num+num

Restrict results to specified categories; see the next section

&sacategoryex=num+num+num

Exclude results from specified categories

&sasaleclass=class

Show (1) auctions only or (2) Buy-It-Now listings only

&sapaypal=1

Show only listings that accept PayPal

Searching in Categories

Although there's no way to specify a category directly in the search field, there is a quick way to convert a standard search to a category-specific search without having to drill down through layers of category links. (See Hack #11 for the long way.)

eBay has thousands of categories (more than 15,000 at the time of this writing), each identified by a unique category number. Although there's no obvious rhyme or reason to the numbering scheme, you may eventually learn the numbers of your favorite categories. The category number is easily found in the URL of the category listing; for example:

http://listings.ebay.com/aw/listings/list/category19116/index.html

Here, the category number is 19116. (You can also get the number of any category by viewing the complete list at listings.ebay.com/aw/plistings/list/categories.html.) To convert a standard search to a category-specific search, simply type the following at the end of the search URL:

&sacategory=19116

You can specify multiple category numbers by separating them with plus signs, something you can't do by clicking links on search pages.

TIP: Categories are typically restricted to a single nationality. For example, a given category number at ebay.com won't be recognized at ebay.de, even though ebay.de may have an equivalent category that goes by a different number. See Hack #15 for details.

View a Seller's Other Items

If you click "View seller's other items" on any auction page, you'll see a listing of all current auctions by that seller. Although you'll find even fewer options here than on the average search page, there are two important URL options you can tweak.

A seller's auction listing URL looks something like this:

http://cgi6.ebay.com/ws/eBayISAPI.dll?ViewSellersOtherItems
       &userid=some_user&since=-1&sort=3&rows=25

By default, only current auctions are shown here, but you can change the since parameter from -1 to any number up to 30 to view past auctions up to 30 days old. You can also change the rows parameter to specify how many auctions to show on a page; the maximum is 200.

It shouldn't take long to discover that typing either of these parameters into the URL is far quicker and more convenient than going to Search → By Seller, typing the seller's name, specifying the age and number of auctions to show, and clicking Search. But you probably saw that coming.

See Also

  • See Hack #30 for a way to change the nationality of most eBay pages.
  • See Hack #16 to keep from having to reconstruct the same searches again and again.
  • See Hack #13 for another way to use search URLs.

Pages: 1, 2, 3

Next Pagearrow