commit 00b712560bec3b0633a37cf49ed89378752e5552
parent 94b8a5ba8c4e9fc96dcb04f911e4b04fdf16777f
Author: Kyle R W Milz <kyle@getaddrinfo.net>
Date: Mon, 11 Aug 2014 20:54:34 -0600
product_scraper: add type column and fix hash init
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/product_scraper.pl b/product_scraper.pl
@@ -33,6 +33,7 @@ $dbh->do("create table if not exists products(" .
"part_num text not null primary key, " .
"brand text, " .
"title text, " .
+ "type text, " .
"first_seen int, " .
"last_seen int)") or die $DBI::errstr;
@@ -44,9 +45,9 @@ $ua->default_header("Accept" => "*/*");
#
# Memory Express
#
-my %product_map = {televisions => "Televisions",
- laptops => "LaptopsNotebooks",
- hard_drives => "HardDrives"};
+my %product_map = ("televisions" => "Televisions",
+ "laptops" => "LaptopsNotebooks",
+ "hard_drives" => "HardDrives");
for (keys %product_map) {
print "*** $_ ***\n";
@@ -109,9 +110,9 @@ for (keys %product_map) {
}
else {
$dbh->do("insert into products(" .
- "part_num, brand, title, first_seen, last_seen)" .
- " values (?, ?, ?, ?, ?)",
- undef, $part_num, $brand, $title, time, time);
+ "part_num, brand, title, type, first_seen, last_seen)" .
+ " values (?, ?, ?, ?, ?, ?)",
+ undef, $part_num, $brand, $title, $_, time, time);
#$dbh->do("create table [$part_num]" .
# "(unix_time int not null primary key)");
push @new_products, ([$brand, $title, $part_num]);