line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::NicoVideo::Content::NicoAPI; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1841
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
5
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
68
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.28'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use base qw(Net::NicoVideo::Content Class::Accessor::Fast); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
170
|
|
9
|
1
|
|
|
1
|
|
8
|
use JSON 2.01; |
|
1
|
|
|
|
|
37
|
|
|
1
|
|
|
|
|
10
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
302
|
use vars qw(@Members); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
695
|
|
12
|
|
|
|
|
|
|
@Members = qw( |
13
|
|
|
|
|
|
|
id |
14
|
|
|
|
|
|
|
mylistgroup |
15
|
|
|
|
|
|
|
mylistitem |
16
|
|
|
|
|
|
|
error |
17
|
|
|
|
|
|
|
status |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@Members); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub members { # implement |
23
|
0
|
|
|
0
|
0
|
|
@Members; |
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 $json = decode_json( $self->_decoded_content ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# member "status" exists in all case |
33
|
0
|
|
|
|
|
|
$self->status( $json->{status} ); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# member "error" exists when error occurs in all case |
36
|
0
|
0
|
|
|
|
|
$self->error( Net::NicoVideo::Content::NicoAPI::Error->new($json->{error}) ) |
37
|
|
|
|
|
|
|
if( $json->{error} ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# member "id" in a case /mylist/add |
40
|
0
|
0
|
|
|
|
|
$self->id( $json->{id} ) |
41
|
|
|
|
|
|
|
if( exists $json->{id} ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# member "mylistgroup" in case /mylistgroup/list or /mylistgroup/get |
44
|
0
|
|
|
|
|
|
my @mg = (); |
45
|
0
|
0
|
|
|
|
|
if( exists $json->{mylistgroup} ){ |
46
|
0
|
0
|
|
|
|
|
if( ref( $json->{mylistgroup} ) ne 'ARRAY' ){ |
47
|
0
|
|
|
|
|
|
$json->{mylistgroup} = [$json->{mylistgroup}]; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
for my $mg ( @{$json->{mylistgroup}} ){ |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
push @mg, Net::NicoVideo::Content::NicoAPI::MylistGroup->new($mg); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
$self->mylistgroup(\@mg); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# TODO member "mylistitem" |
56
|
0
|
|
|
|
|
|
my @mi = (); |
57
|
0
|
0
|
|
|
|
|
if( exists $json->{mylistitem} ){ |
58
|
0
|
0
|
|
|
|
|
if( ref( $json->{mylistitem} ) ne 'ARRAY' ){ |
59
|
0
|
|
|
|
|
|
$json->{mylistitem} = [$json->{mylistitem}]; |
60
|
|
|
|
|
|
|
} |
61
|
0
|
|
|
|
|
|
for my $mi ( @{$json->{mylistitem}} ){ |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $item = Net::NicoVideo::Content::NicoAPI::MylistItem->new($mi); |
63
|
0
|
|
|
|
|
|
$item->item_data( Net::NicoVideo::Content::NicoAPI::MylistItem::ItemData->new($mi->{item_data}) ); |
64
|
0
|
|
|
|
|
|
push @mi, $item; |
65
|
|
|
|
|
|
|
} |
66
|
0
|
|
|
|
|
|
$self->mylistitem(\@mi); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# status |
70
|
0
|
0
|
|
|
|
|
if( $self->is_status_ok ){ |
71
|
0
|
|
|
|
|
|
$self->set_status_success; |
72
|
|
|
|
|
|
|
}else{ |
73
|
0
|
|
|
|
|
|
$self->set_status_error; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub is_status_ok { |
80
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
81
|
0
|
0
|
|
|
|
|
$self->status and lc($self->status) eq 'ok'; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub error_code { |
85
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
86
|
0
|
0
|
|
|
|
|
$self->error and $self->error->code; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub error_description { |
90
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
91
|
0
|
0
|
|
|
|
|
$self->error and $self->error->description; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub is_error_noauth { |
95
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
96
|
0
|
0
|
0
|
|
|
|
$self->error and $self->error->code and uc($self->error->code) eq 'NOAUTH'; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
package Net::NicoVideo::Content::NicoAPI::Error; |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
103
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
104
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
105
|
|
|
|
|
|
|
$VERSION = '0.28'; |
106
|
|
|
|
|
|
|
|
107
|
1
|
|
|
1
|
|
4
|
use base qw(Class::Accessor::Fast); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
82
|
|
108
|
1
|
|
|
1
|
|
5
|
use vars qw(@Members); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
103
|
|
109
|
|
|
|
|
|
|
@Members = qw( |
110
|
|
|
|
|
|
|
code |
111
|
|
|
|
|
|
|
description |
112
|
|
|
|
|
|
|
); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@Members); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub members { |
117
|
0
|
|
|
0
|
|
|
@Members; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
package Net::NicoVideo::Content::NicoAPI::MylistGroup; |
122
|
|
|
|
|
|
|
|
123
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
124
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
125
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
126
|
|
|
|
|
|
|
$VERSION = '0.28'; |
127
|
|
|
|
|
|
|
|
128
|
1
|
|
|
1
|
|
4
|
use base qw(Class::Accessor::Fast); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
67
|
|
129
|
1
|
|
|
1
|
|
6
|
use vars qw(@Members); |
|
1
|
|
|
|
|
23
|
|
|
1
|
|
|
|
|
84
|
|
130
|
|
|
|
|
|
|
@Members = qw( |
131
|
|
|
|
|
|
|
id |
132
|
|
|
|
|
|
|
user_id |
133
|
|
|
|
|
|
|
name |
134
|
|
|
|
|
|
|
description |
135
|
|
|
|
|
|
|
public |
136
|
|
|
|
|
|
|
default_sort |
137
|
|
|
|
|
|
|
create_time |
138
|
|
|
|
|
|
|
update_time |
139
|
|
|
|
|
|
|
sort_order |
140
|
|
|
|
|
|
|
icon_id |
141
|
|
|
|
|
|
|
); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@Members); |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub members { |
146
|
0
|
|
|
0
|
|
|
@Members; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
package Net::NicoVideo::Content::NicoAPI::MylistItem; |
151
|
|
|
|
|
|
|
|
152
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
153
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
154
|
1
|
|
|
1
|
|
13
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
155
|
|
|
|
|
|
|
$VERSION = '0.28'; |
156
|
|
|
|
|
|
|
|
157
|
1
|
|
|
1
|
|
5
|
use base qw(Class::Accessor::Fast); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
79
|
|
158
|
1
|
|
|
1
|
|
6
|
use vars qw(@Members); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
214
|
|
159
|
|
|
|
|
|
|
@Members = qw( |
160
|
|
|
|
|
|
|
item_type |
161
|
|
|
|
|
|
|
item_id |
162
|
|
|
|
|
|
|
description |
163
|
|
|
|
|
|
|
item_data |
164
|
|
|
|
|
|
|
watch |
165
|
|
|
|
|
|
|
create_time |
166
|
|
|
|
|
|
|
update_time |
167
|
|
|
|
|
|
|
); |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@Members); |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub members { |
172
|
0
|
|
|
0
|
|
|
@Members; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
package Net::NicoVideo::Content::NicoAPI::MylistItem::ItemData; |
177
|
|
|
|
|
|
|
|
178
|
1
|
|
|
1
|
|
12
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
179
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
180
|
1
|
|
|
1
|
|
9
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
181
|
|
|
|
|
|
|
$VERSION = '0.28'; |
182
|
|
|
|
|
|
|
|
183
|
1
|
|
|
1
|
|
5
|
use base qw(Class::Accessor::Fast); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
77
|
|
184
|
1
|
|
|
1
|
|
5
|
use vars qw(@Members); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
105
|
|
185
|
|
|
|
|
|
|
@Members = qw( |
186
|
|
|
|
|
|
|
video_id |
187
|
|
|
|
|
|
|
title |
188
|
|
|
|
|
|
|
thumbnail_url |
189
|
|
|
|
|
|
|
first_retrieve |
190
|
|
|
|
|
|
|
update_time |
191
|
|
|
|
|
|
|
view_counter |
192
|
|
|
|
|
|
|
mylist_counter |
193
|
|
|
|
|
|
|
num_res |
194
|
|
|
|
|
|
|
group_type |
195
|
|
|
|
|
|
|
length_seconds |
196
|
|
|
|
|
|
|
deleted |
197
|
|
|
|
|
|
|
last_res_body |
198
|
|
|
|
|
|
|
watch_id |
199
|
|
|
|
|
|
|
); |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@Members); |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub members { |
204
|
0
|
|
|
0
|
|
|
@Members; |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
1; |
209
|
|
|
|
|
|
|
__END__ |