commit cd3e77577e84da6ea619cde32a79aa584ba3a2b2
parent 03fa9576af05e26f8919835495a7ccd4312e1b5f
Author: Kyle Milz <kyle@getaddrinfo.net>
Date: Mon, 3 Nov 2014 21:13:39 -0700
product_scraper: rename product -> thumbnail_dom
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/product_scraper.pl b/product_scraper.pl
@@ -85,20 +85,21 @@ for (keys %product_map) {
my $start = time;
for my $node (@results) {
sleep int(rand(10));
- my $product = HTML::Grabber->new(html => $node);
+
+ my $thumbnail_dom = HTML::Grabber->new(html => $node);
# used to visit the actual product page
- my $product_id = get_tag_text($product, ".ProductId");
+ my $product_id = get_tag_text($thumbnail_dom, ".ProductId");
next unless (defined $product_id);
- my $description = get_tag_text($product, ".ProductTitle");
+ my $description = get_tag_text($thumbnail_dom, ".ProductTitle");
next unless (defined $description);
# brand is easier to parse from general results page, sometimes
# shows up as text
- my $brand = $product->find(".ProductBrand")->text();
+ my $brand = $thumbnail_dom->find(".ProductBrand")->text();
if ($brand eq "") {
- $brand = $product->find(".ProductBrand")->html();
+ $brand = $thumbnail_dom->find(".ProductBrand")->html();
($brand) = ($brand =~ m/Brand: ([A-Za-z]+)/);
}
next if (not_defined($brand, "brand", $node));