eBay search - a simple perl script


The script can be downloaded here. Please submit any suggestions or code.


this script will take all the search terms in an input stream, search ebay for them, and output the resulting item listings into an html-formatted file which is nicely output with item descriptions and numbers in individual tables. at least _i_ think it's nice, hehe.

order the terms in the search file in the order that you would like them output. ie if you have more important searches that you'd like to be at the top of your results for easy access, put them first in the input file.

TODO the script will automatically weed out duplicate hits within a particular item's search terms.


the program reads from stdin, so you can use a file, or use the program as a commandline interface for searching ebay :)

in an input file, group together all of the search terms for a particular item, each on an individual line, and then separate them with any single character on a line. the search terms themselves must be >2 characters, and the divider must be 2 chars or less.

consult the example ebay.data for format questions.

don't use any special characters, it might break the script.


the script will write to stdout. to redirect output to a file (to be read by a web browser):

$ ./ebay.pl < ebay.data > ebay-results.html

if you want plaintext, just pipe it through html2text:

$ ./ebay.pl < ebay.data | html2text -nobs > ebay-results.txt

the script outputs newest-listed items first by default. read the documentation in the script source to find out how to change this.

to automatically start a lynx session with the output:

$ ./ebay.pl < ebay.data | lynx -stdin
and wait a few seconds, lynx won't start rendering until the input stream is done.


to use via command line, just don't pipe anything into it:

$ ./ebay.pl | html2text

enter the term/terms you wish to search for, grouped as they would be in an input file, or just single terms, and hit Ctrl-D on a new line when finished. you should get pretty output with the item descriptions and numbers that match.

if you want to have your search immediately displayed in lynx:

$ ./ebay.pl | lynx -stdin


to set up a cron job to check your ebay stuff on a regular basis and update the file, just do a crontab -e and add the following line:

@daily $HOME/ebay/ebay.pl < $HOME/ebay/ebay.data > $HOME/ebay/ebay-results.html

This will update your ebay "cache" every day at midnight. If you're more of a freak, read the cron manpage and set it up hourly, or by the minute ;-)


for support, comments, suggestions, flames, email <nemesis at icequake.net>