Skip to content

Instantly share code, notes, and snippets.

@rossdakin
Created December 31, 2014 00:50
Show Gist options
  • Save rossdakin/c9909fa1f0ff504fb440 to your computer and use it in GitHub Desktop.
Save rossdakin/c9909fa1f0ff504fb440 to your computer and use it in GitHub Desktop.
Sketchers Price Alert Script
#! /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";
}
@rossdakin
Copy link
Author

A fun little ditty from years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment