Skip to content

Instantly share code, notes, and snippets.

@kshoji
Created September 6, 2013 09:05
Show Gist options
  • Save kshoji/6461360 to your computer and use it in GitHub Desktop.
Save kshoji/6461360 to your computer and use it in GitHub Desktop.
Shows the status of [Apple Developer System Status](https://developer.apple.com/support/system-status/).
#! /usr/bin/env perl
use warnings;
use strict;
use LWP::Protocol::https;
use Web::Scraper;
use YAML;
my $urlToScrape = "https://developer.apple.com/support/system-status/";
my $teamsdata = scraper {
process "table.status-table > tr > td.offline > span", 'down[]' => 'TEXT';
process "table.status-table > tr > td.online > span", 'up[]' => 'TEXT';
};
my $res = $teamsdata->scrape(URI->new($urlToScrape));
if (scalar @ARGV == 0) {
for my $service ( @{ $res->{up} } ) {
print $service, " - up\n";
}
for my $service ( @{ $res->{down} } ) {
print $service, " - down\n";
}
} elsif ($ARGV[0] eq 'up') {
for my $service ( @{ $res->{up} } ) {
print $service, "\n";
}
} elsif ($ARGV[0] eq 'down') {
for my $service ( @{ $res->{down} } ) {
print $service, "\n";
}
} else {
print STDERR "Usage: appleDeveloperSystemStatus.pl [up|down|]\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment