Created
June 9, 2011 10:15
-
-
Save ishiduca/1016470 to your computer and use it in GitHub Desktop.
get 'pixiv' staccfeed
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 WWW::Pixiv::Download; | |
use Config::Pit qw(pit_get); | |
use JSON qw(decode_json); | |
my $home = 'http://www.pixiv.net'; | |
my $stacc = "${home}/stacc/"; | |
my $json_url = "${home}/stacc/my/home/all/all/js?tt=%%STACC_TOKEN%%"; | |
my $config = pit_get('www.pixiv.net', require => { | |
pixiv_id => '', pass => '', | |
}); | |
my $client = WWW::Pixiv::Download->new( | |
pixiv_id => $config->{pixiv_id}, | |
pass => $config->{pass}, | |
# look => 1, | |
); | |
$client->login; | |
my $ua = $client->user_agent; | |
# go to "http://www.pixiv.net/stacc/'; | |
my $res = $ua->get($stacc); | |
die '! '. $res->status_line unless $res->is_success; | |
# get STACC_token && set Referer | |
$client->{referer} = $stacc; | |
$json_url =~ s/ %%STACC_TOKEN%% /($res->decoded_content =~ m!id="STACC_token"\s+value="([^"]+?)"!)[0]/xe; | |
# get stacc json | |
$res = $ua->get( $json_url ); | |
die '! '. $res->status_line unless $res->is_success; | |
my $parse_json = decode_json $res->{_content}; | |
#for my $status ( keys %{$parse_json->{status}} ) { | |
# print Dumper $parse_json->{status}->{$status}; | |
#} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment