Wednesday, November 08, 2006

Monitor eBay for new items

I've been looking at the Sharp Zaurus SL-5500 for a bit of time. Wireless + Openssh + internet browsing + mp3 + movie = geek happiness. (honestly, I really only care about the wireless, and openssh, but the rest is pure icing!) The Zaurus series runs a full distribution of Linux which = teh roxor. I'm trying to be a bit more careful about my handheld device purchases, because I sure hate spending money on something I'm not going to use, or stop using after a short while. The SL-5500 is a perfect introduction to the Zaurus series since they are plentiful and can (usually) be had for a little over $100. People don't like them because they have very limited battery life when using wireless, but there are ways around that. I figured I would be able to get acquainted with the Zaurus and see how I like it, and if I lose interest in it easily. Then, I can decide if I want to get a SL-6000 or something.

But I digress...

The reason this script was put together was because someone posted their sl-5500 for a very low price on the buy it now feature, and it was snatched up (what I can only assume was) very quickly. This script will check to see if there are any new items in the search results, and send you an sms with the item number so you can check it out. Note that this script only searches one page, though could probably be changed to search many or all pages...


#!/usr/bin/perl

$message='sl 5500';

@rray=split ('<tr ', `curl -L 'http://tinyurl.com/yn4hkf 2>/dev/null|grep 'List View'`);
if(@rray[0]!~/script/){print "fission mailed!\n"; exit;}

$oldids=`cat sl5500.ids`;
`rm -f sl5500.ids`;

for(@rray){
if($_=~/ebLeft/){
for(split('<td ', $_)){
if(/coitem\" value="(\d+)"/){
$id=$1;
if($oldids!~/$id/){
`/home/bishop/sms.pl $message -- $id`;
}
`echo $id >> sl5500.ids`;
}
}
}
}


If you wish to make your own script, make sure you add a check like in line 3 to make sure ebay responds to you. For some reason, every 20th or so try would get a connection reset from ebay. This made no sense, so I just tossed in that check. It pretty much runs the same way my gmail notifier works. Simple is good.

No comments: