#!/usr/bin/perl
# Save HTML version of an ebay alert mail message. It already has an
# HTML version in it, so this mostly just strips the other stuff. It
# also grabs a few things from the mail header and adds them to the
# html/head element.
# For demo purposes only. No warrantee expressed or implied.
use strict;
my $inHTML = 0;
my $searchName = ""; # "Name of Search" when saving it in eBay
my $atomFilename = "";
while (<>) {
# Sample mail subject line:
# Subject: eBay Favorite Search: elvis black velvet
if (s/Subject: eBay Favorite Search: //) {
chop($_);
$searchName = $_;
$atomFilename = $searchName;
$atomFilename =~ s/ /_/g;
}
s/\ \;/ /g;
s/\n/ /g;
s/\s+/ /g;
s/\s*/) {
$_ = $_ . "\n\n";
}
if (/cgi.ebay.com\/ws\/.*item=(\d+)/) {
$_ = $_ . ""
}
if (/";
}
# Remove doubleclick prefix from link to item's page.
s/http:\/\/ebay.doubleclick.net\/clk.*?http:\/\/cgi.ebay.com/http:\/\/cgi.ebay.com/g;
print if ($inHTML);
$inHTML = 0 if (/<\/html>/);
}