ひびちからじおの更新をチェックするですよー

最初はお手軽にwgetでヘッダー情報を取ってくるとか中身をdiffすればいいとか考えたんだけど、どうもそれだけでは不十分のようで、結局スクレイピングすることに。

use strict;
use warnings;
use Web::Scraper;
use URI;
use Win32;
use utf8;
binmode STDOUT, ":utf8";

my ($contents, $contents_old);

while(1){
  $contents = join("\n", @{+scraper{
    process 'td.radio_td', 'contents[]' => 'TEXT';
    result 'contents';
  }->scrape(new URI('http://www.animate.tv/radio/details.php?id=hibichika'))});

  print scalar localtime, "\n$contents\n";
  if($contents_old and ($contents ne $contents_old)){
    Win32::MsgBox("updated", MB_ICONINFORMATION, "message");
    last;
  }
  $contents_old = $contents;
  sleep 60*10;
}

もう今日使えればそれでいい的な!