line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::NicoVideo::Content::MylistItem; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1722
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
7
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
58
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.28'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use base qw(Net::NicoVideo::Content Class::Accessor::Fast); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
149
|
|
9
|
1
|
|
|
1
|
|
3724
|
use HTML::Parser 3.00; |
|
1
|
|
|
|
|
10779
|
|
|
1
|
|
|
|
|
58
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
12
|
use vars qw(@Members); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
630
|
|
12
|
|
|
|
|
|
|
@Members = qw( |
13
|
|
|
|
|
|
|
item_type |
14
|
|
|
|
|
|
|
item_id |
15
|
|
|
|
|
|
|
description |
16
|
|
|
|
|
|
|
token |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@Members); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub members { # implement |
22
|
0
|
|
|
0
|
0
|
|
my @copy = @Members; |
23
|
0
|
|
|
|
|
|
@copy; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub parse { # implement |
27
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
28
|
0
|
0
|
|
|
|
|
$self->load($_[0]) if( defined $_[0] ); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $content = $self->_decoded_content; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# take NicoAPI.token |
33
|
0
|
0
|
|
|
|
|
if( $content =~ /NicoAPI\.token\s*=\s*"([-\w]+)"/ ){ |
34
|
0
|
|
|
|
|
|
$self->token( $1 ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# take item_type and item_id using HTML::Parser |
38
|
0
|
|
|
|
|
|
my $item_type = undef; |
39
|
0
|
|
|
|
|
|
my $item_id = undef; |
40
|
0
|
|
|
|
|
|
my $description = undef; |
41
|
0
|
|
|
|
|
|
my $p; |
42
|
|
|
|
|
|
|
$p = HTML::Parser->new( |
43
|
|
|
|
|
|
|
api_version => 3, |
44
|
|
|
|
|
|
|
start_h => [ sub { |
45
|
0
|
|
|
0
|
|
|
my ($tagname, $attr) = @_; |
46
|
0
|
0
|
|
|
|
|
if( lc($tagname) eq 'input' ){ |
47
|
0
|
0
|
0
|
|
|
|
if( exists $attr->{name} and lc($attr->{name}) eq 'item_type' ){ |
48
|
0
|
|
|
|
|
|
$item_type = $attr->{value}; |
49
|
|
|
|
|
|
|
} |
50
|
0
|
0
|
0
|
|
|
|
if( exists $attr->{name} and lc($attr->{name}) eq 'item_id' ){ |
51
|
0
|
|
|
|
|
|
$item_id = $attr->{value}; |
52
|
|
|
|
|
|
|
} |
53
|
0
|
0
|
0
|
|
|
|
if( exists $attr->{name} and lc($attr->{name}) eq 'description' ){ |
54
|
0
|
|
|
|
|
|
$description= $attr->{value}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
0
|
0
|
0
|
|
|
|
$p->eof if( defined $item_type and defined $item_id and defined $description ); |
|
|
|
0
|
|
|
|
|
58
|
0
|
|
|
|
|
|
}, 'tagname, attr']); |
59
|
0
|
|
|
|
|
|
$p->parse($content); |
60
|
0
|
|
|
|
|
|
$self->item_type( $item_type ); |
61
|
0
|
|
|
|
|
|
$self->item_id( $item_id ); |
62
|
0
|
|
|
|
|
|
$self->description( $description ); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# status |
65
|
0
|
0
|
0
|
|
|
|
if( defined $self->item_id and defined $self->item_type ){ |
66
|
0
|
|
|
|
|
|
$self->set_status_success; |
67
|
|
|
|
|
|
|
}else{ |
68
|
0
|
|
|
|
|
|
$self->set_status_error; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return $self; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
__END__ |