Created
December 31, 2014 00:50
-
-
Save rossdakin/c9909fa1f0ff504fb440 to your computer and use it in GitHub Desktop.
Sketchers Price Alert Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
use strict; | |
use LWP::UserAgent; | |
my $ua = new LWP::UserAgent; | |
$ua->timeout(120); | |
my $url='http://www.skechers.com/style/62358/audience-intended/BLK'; | |
my $request = new HTTP::Request('GET', $url); | |
my $response = $ua->request($request); | |
my $content = $response->content(); | |
$content =~ m/<sku size="11\.5" in-stock="(\w+)" price="(\d+\.\d+)"/i; | |
my $in_stock = $1 == "true"; | |
my $price = $2 + 0; | |
print " Price: \$$price\n"; | |
print " In stock: " . ($in_stock ? "yes" : "no") . "\n"; | |
my $old_price = 59.00; | |
if ($price != $old_price) { | |
print " *** Price Change (from \$$old_price) ***\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A fun little ditty from years ago.