Created
March 31, 2009 11:43
-
-
Save mattn/88157 to your computer and use it in GitHub Desktop.
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
use strict; | |
use warnings; | |
use Config::Pit; | |
use WWW::Mechanize; | |
use Web::Scraper; | |
use YAML; | |
my $config = pit_get( | |
'github.com', | |
require => { | |
'username' => 'your username on github.com', | |
'password' => 'your password on github.com' | |
} | |
); | |
my $mech = WWW::Mechanize->new(); | |
$mech->add_header( 'Accept-Encoding', 'identity' ); | |
$mech->get('https://github.com/login'); | |
$mech->submit_form( | |
form_number => 2, | |
fields => { | |
login => $config->{username}, | |
password => $config->{password}, | |
} | |
); | |
my $res = $mech->get('https://github.com/dashboard/yours'); | |
my $repos = scraper { | |
process '//div[contains(concat(" ",@class," ")," watching ")]//li', | |
'repos[]' => scraper { | |
process '//b/a', title => 'TEXT', url => '@href'; | |
}; | |
result 'repos'; | |
}->scrape($res); | |
my $collabo = scraper { | |
process 'id("private-clone-url")', 'info' => scraper { | |
process '//a', title => 'TEXT', url => '@href'; | |
}; | |
result 'info'; | |
}; | |
for my $repo ( @{$repos} ) { | |
my $url = $repo->{url}->as_string . "/master"; | |
my $info = $collabo->scrape( $mech->get($url) ); | |
warn $url if $info->{url}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment