Created
March 29, 2014 17:15
-
-
Save equinox79/9858297 to your computer and use it in GitHub Desktop.
chrome拡張のユーザ数をImKayacで通知するスクリプト
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/env perl | |
use strict; | |
use warnings; | |
use Web::Query; | |
use WebService::ImKayac::Simple; | |
use Log::Minimal; | |
# 自分のImKayacのアカウント | |
# パスワードとか鍵設定してる人は適当に直してください | |
my $im_kayac_user = '__USER_NAME__'; | |
# 拡張のパーマリンクの共通部分 | |
my $url_base = "https://chrome.google.com/webstore/detail"; | |
# ここに拡張のパーマリンクの残り部分 | |
my @app_list = ( | |
"/twitter-search-it/ampkcohimpfbgopdhbnllmgofhmcbdla", | |
"/clone-to-sourcetree-butto/ebglgbilpccfljajcocchgpaddgapaoa" | |
); | |
my $msg = ""; | |
for my $app_path (@app_list) { | |
my $wq = wq( $url_base . $app_path ); | |
my $app_name = undef; | |
$wq->find("h1.webstore-test-detail-dialog-title")->each( | |
sub { | |
my ( undef, $wq ) = @_; | |
$app_name = $wq->text(); | |
} | |
); | |
my $app_user = undef; | |
$wq->find(".webstore-f-g-Fe")->first()->each( | |
sub { | |
my ( undef, $wq ) = @_; | |
$app_user = $wq->text(); | |
} | |
); | |
if ( $app_name && $app_user ) { | |
$msg .= sprintf( "%s : %s\n", $app_name, $app_user ); | |
} else { | |
warnf "app_name is not found." unless ($app_name); | |
warnf "app_user is not found." unless ($app_user); | |
} | |
} | |
if ($msg) { | |
my $im = WebService::ImKayac::Simple->new( user => $im_kayac_user, ); | |
$im->send($msg); | |
infof $msg; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment