commit b613ac2dd0c113706143b08767091c8a187c1178
parent c5f6d4e5a44c3b8a5f67a674e0c3475dbcff9b9f
Author: Kyle Milz <kyle@getaddrinfo.net>
Date: Mon, 3 Nov 2014 21:46:55 -0700
product_scraper: convert last user of not_defined
Diffstat:
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/product_scraper.pl b/product_scraper.pl
@@ -111,7 +111,11 @@ for (keys %product_map) {
$brand = $thumbnail_dom->find(".ProductBrand")->html();
($brand) = ($brand =~ m/Brand: ([A-Za-z]+)/);
}
- next if (not_defined($brand, ".ProductBrand", $thumbnail_html));
+ if (!defined $brand || $brand eq "") {
+ vprint("could not find .ProductBrand, html was:\n");
+ vprint("$thumbnail_html\n\n");
+ next;
+ }
$product_sth->execute($part_num);
if ($product_sth->fetchrow_arrayref()) {
@@ -179,20 +183,6 @@ $sender->send($e_mail->as_string()) || print "Couldn't send email\n";
# televisions_page = &px=<PAGE>
# product_list = .centerPanel
-sub not_defined
-{
- my $field = shift;
- my $field_name = shift;
- my $html = shift;
-
- if (!defined $field || $field eq "" ) {
- vprint("could not find $field_name, html was:\n");
- vprint("$html\n");
- return 1;
- }
- return 0;
-}
-
sub get_tag_text
{
my $dom = shift;