line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::GData::YouTube; |
2
|
2
|
|
|
2
|
|
41423
|
use WebService::GData; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
3
|
2
|
|
|
2
|
|
13
|
use base 'WebService::GData'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
227
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1466
|
use WebService::GData::Base; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
22
|
|
6
|
2
|
|
|
2
|
|
1669
|
use WebService::GData::YouTube::Constants; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
130
|
|
7
|
2
|
|
|
2
|
|
1257
|
use WebService::GData::YouTube::Query; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
14
|
|
8
|
2
|
|
|
2
|
|
532
|
use WebService::GData::YouTube::StagingServer (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
35
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#TODO: load these packages on demand |
11
|
2
|
|
|
2
|
|
1048
|
use WebService::GData::YouTube::Feed; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
32
|
|
12
|
2
|
|
|
2
|
|
16210
|
use WebService::GData::YouTube::Feed::PlaylistLink; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
34
|
|
13
|
2
|
|
|
2
|
|
1327
|
use WebService::GData::YouTube::Feed::Video; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
44
|
|
14
|
2
|
|
|
2
|
|
1438
|
use WebService::GData::YouTube::Feed::Comment; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
41
|
|
15
|
2
|
|
|
2
|
|
2403
|
use WebService::GData::YouTube::Feed::Complaint; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
34
|
|
16
|
2
|
|
|
2
|
|
1319
|
use WebService::GData::YouTube::Feed::Friend; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
39
|
|
17
|
2
|
|
|
2
|
|
1566
|
use WebService::GData::YouTube::Feed::VideoMessage; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
33
|
|
18
|
|
|
|
|
|
|
#end |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $PROJECTION = WebService::GData::YouTube::Constants::PROJECTION; |
21
|
|
|
|
|
|
|
our $BASE_URI = WebService::GData::YouTube::Constants::BASE_URI; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
if(WebService::GData::YouTube::StagingServer->is_on){ |
24
|
|
|
|
|
|
|
$BASE_URI = WebService::GData::YouTube::Constants::STAGING_BASE_URI; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = 0.0206; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub __init { |
30
|
1
|
|
|
1
|
|
4
|
my ( $this, $auth ) = @_; |
31
|
1
|
|
|
|
|
72
|
$this->{_baseuri} = $BASE_URI . $PROJECTION . '/'; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
11
|
$this->{_request} = new WebService::GData::Base(); |
34
|
1
|
50
|
|
|
|
4
|
$this->{_request}->auth($auth) if ($auth); |
35
|
1
|
|
|
|
|
3
|
$this->{__cache__}={}; |
36
|
|
|
|
|
|
|
#overwrite default query engine to support youtube extra feature |
37
|
1
|
|
|
|
|
13
|
my $query = new WebService::GData::YouTube::Query(); |
38
|
1
|
50
|
|
|
|
4
|
$query->key( $auth->key ) if ($auth); |
39
|
1
|
|
|
|
|
6
|
$this->query($query); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub connection { |
43
|
0
|
|
|
0
|
1
|
0
|
my ( $this ) = @_; |
44
|
0
|
|
|
|
|
0
|
return $this->{_request}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub query { |
48
|
1
|
|
|
1
|
1
|
2
|
my ( $this, $query ) = @_; |
49
|
1
|
|
|
|
|
5
|
return $this->{_request}->query($query); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub base_uri { |
53
|
1
|
|
|
1
|
1
|
8
|
my $this = shift; |
54
|
1
|
|
|
|
|
13
|
return $this->{_baseuri}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub base_query { |
58
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
59
|
0
|
|
|
|
|
|
return $this->query->to_query_string; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#playlist related |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub get_user_playlist_by_id { |
65
|
0
|
|
|
0
|
1
|
|
my ( $this, $playlistid,$preserve_start_index) = @_; |
66
|
|
|
|
|
|
|
|
67
|
0
|
0
|
0
|
|
|
|
return if(exists $this->{__cache__}->{$playlistid} && !$this->{__cache__}->{$playlistid}); |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $uri; |
70
|
0
|
0
|
|
|
|
|
if($this->{__cache__}->{$playlistid}){ |
71
|
0
|
|
|
|
|
|
$uri = $this->{__cache__}->{$playlistid}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
else { |
74
|
0
|
0
|
|
|
|
|
$this->query->start_index(1) if !$preserve_start_index; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
my @request=$uri ? ($uri,1) : $this->{_baseuri} . 'playlists/' . $playlistid; |
78
|
0
|
|
|
|
|
|
my $res = |
79
|
|
|
|
|
|
|
$this->{_request}->get(@request); |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my $feed = |
82
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
$this->{__cache__}->{$playlistid}= $feed->next_link; |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
return wantarray ? ($feed->entry,$feed):$feed->entry; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub get_user_playlists { |
90
|
0
|
|
|
0
|
1
|
|
my ( $this, $channel,$preserve_start_index ) = @_; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#by default, the one connected is returned |
93
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'users/default/playlists'; |
94
|
0
|
0
|
|
|
|
|
$uri = $this->{_baseuri} . 'users/' . $channel . '/playlists' if ($channel); |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
0
|
|
|
|
return if(exists $this->{__cache__}->{$uri} && !$this->{__cache__}->{$uri}); |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
my $next_url; |
99
|
0
|
0
|
|
|
|
|
if($this->{__cache__}->{$uri}){ |
100
|
0
|
|
|
|
|
|
$next_url = $this->{__cache__}->{$uri}; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
else { |
103
|
0
|
0
|
|
|
|
|
$this->query->start_index(1) if !$preserve_start_index; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
my @request=$next_url ? ($next_url,1) : $uri; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get(@request); |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
my $feed = |
112
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
$this->{__cache__}->{$uri}= $feed->next_link; |
115
|
|
|
|
|
|
|
|
116
|
0
|
0
|
|
|
|
|
return wantarray ? ($feed->entry,$feed):$feed->entry; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub get_user_profile { |
120
|
0
|
|
|
0
|
1
|
|
my ( $this, $channel ) = @_; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
#by default, the one connected is returned |
123
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'users/default/'; |
124
|
0
|
0
|
|
|
|
|
$uri = $this->{_baseuri} . 'users/' . $channel if ($channel); |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
127
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
my $playlists = |
129
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
130
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
return $playlists->entry->[0]; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub get_user_contacts { |
135
|
0
|
|
|
0
|
1
|
|
my ( $this, $channel ) = @_; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#by default, the one connected is returned |
138
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'users/default/contacts'; |
139
|
0
|
0
|
|
|
|
|
$uri = $this->{_baseuri} . 'users/' . $channel.'/contacts' if ($channel); |
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
my $contacts = |
144
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
return $contacts->entry; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub get_user_inbox { |
150
|
0
|
|
|
0
|
1
|
|
my ( $this ) = @_; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
#by default, the one connected is returned |
153
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'users/default/inbox'; |
154
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
return |
158
|
0
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} )->entry; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
#video related |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub like_video { |
165
|
0
|
|
|
0
|
1
|
|
my ($this,$id) = @_; |
166
|
0
|
|
|
|
|
|
my $vid = $this->video; |
167
|
0
|
|
|
|
|
|
$vid->video_id($id); |
168
|
0
|
|
|
|
|
|
$vid->rate('like'); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub dislike_video { |
172
|
0
|
|
|
0
|
1
|
|
my ($this,$id) = @_; |
173
|
0
|
|
|
|
|
|
my $vid = $this->video; |
174
|
0
|
|
|
|
|
|
$vid->video_id($id); |
175
|
0
|
|
|
|
|
|
$vid->rate('dislike'); |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub add_video_response { |
179
|
0
|
|
|
0
|
1
|
|
my ($this,$video_id,$response_id) = @_; |
180
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
my $video = $this->video; |
182
|
0
|
|
|
|
|
|
$video->video_id($video_id); |
183
|
0
|
|
|
|
|
|
my $response = $this->video; |
184
|
0
|
|
|
|
|
|
$response->id($response_id); |
185
|
0
|
|
|
|
|
|
$video->add_video_response($response); |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub delete_video_response { |
189
|
0
|
|
|
0
|
1
|
|
my ($this,$video_id,$response_id) = @_; |
190
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
my $video = $this->video; |
192
|
0
|
|
|
|
|
|
$video->video_id($video_id); |
193
|
0
|
|
|
|
|
|
$video->delete_video_response($response_id); |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub add_favorite_video { |
198
|
0
|
|
|
0
|
1
|
|
my ($this,$video_id) = @_; |
199
|
0
|
|
|
|
|
|
my $video = $this->video; |
200
|
0
|
|
|
|
|
|
$video->add_favorite_video($video_id); |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub video { |
204
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
205
|
0
|
|
|
|
|
|
return new WebService::GData::YouTube::Feed::Video( $this->{_request} ); |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub playlists { |
209
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
210
|
0
|
|
|
|
|
|
return new WebService::GData::YouTube::Feed::PlaylistLink( $this->{_request} ); |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub comment { |
214
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
215
|
0
|
|
|
|
|
|
return new WebService::GData::YouTube::Feed::Comment( $this->{_request} ); |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub complaint { |
219
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
220
|
0
|
|
|
|
|
|
return new WebService::GData::YouTube::Feed::Complaint( $this->{_request} ); |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
sub contact { |
224
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
225
|
0
|
|
|
|
|
|
return new WebService::GData::YouTube::Feed::Friend( $this->{_request} ); |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub message { |
229
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
230
|
0
|
|
|
|
|
|
return new WebService::GData::YouTube::Feed::VideoMessage( $this->{_request} ); |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub search_video { |
234
|
0
|
|
|
0
|
1
|
|
my ( $this, $query ) = @_; |
235
|
0
|
0
|
|
|
|
|
$this->query($query) if ($query); |
236
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get( $this->{_baseuri} . 'videos/' ); |
237
|
0
|
|
|
|
|
|
my $playlists = |
238
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
239
|
0
|
|
|
|
|
|
return $playlists->entry; |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub get_video_by_id { |
243
|
0
|
|
|
0
|
1
|
|
my ( $this, $id ) = @_; |
244
|
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'videos/' . $id; |
246
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
248
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
|
my $playlists = |
250
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
251
|
|
|
|
|
|
|
|
252
|
0
|
|
|
|
|
|
return $playlists->entry->[0]; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub get_user_video_by_id { |
256
|
0
|
|
|
0
|
1
|
|
my ( $this, $id, $channel ) = @_; |
257
|
|
|
|
|
|
|
|
258
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'users/default/uploads/' . $id; |
259
|
0
|
0
|
|
|
|
|
$uri = $this->{_baseuri} . 'users/' . $channel . '/uploads/' . $id |
260
|
|
|
|
|
|
|
if ($channel); |
261
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
my $playlists = |
265
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
266
|
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
|
return $playlists->entry->[0]; |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
sub get_user_videos { |
271
|
0
|
|
|
0
|
1
|
|
my ( $this, $channel ) = @_; |
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'users/default/uploads'; |
274
|
0
|
0
|
|
|
|
|
$uri = $this->{_baseuri} . 'users/' . $channel . '/uploads' if ($channel); |
275
|
|
|
|
|
|
|
|
276
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
my $playlists = |
279
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
280
|
|
|
|
|
|
|
|
281
|
0
|
|
|
|
|
|
return $playlists->entry; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub get_user_favorite_videos { |
285
|
0
|
|
|
0
|
1
|
|
my ( $this, $channel ) = @_; |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'users/default/favorites/'; |
288
|
0
|
0
|
|
|
|
|
$uri = $this->{_baseuri} . 'users/' . $channel . '/favorites/' |
289
|
|
|
|
|
|
|
if ($channel); |
290
|
|
|
|
|
|
|
|
291
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
292
|
|
|
|
|
|
|
|
293
|
0
|
|
|
|
|
|
my $feed = |
294
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
return $feed->entry; |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub get_recommended_videos { |
300
|
0
|
|
|
0
|
1
|
|
my ( $this) = @_; |
301
|
|
|
|
|
|
|
|
302
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'users/default/recommendations'; |
303
|
|
|
|
|
|
|
|
304
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
305
|
|
|
|
|
|
|
|
306
|
0
|
|
|
|
|
|
my $feed = |
307
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
308
|
|
|
|
|
|
|
|
309
|
0
|
|
|
|
|
|
return $feed->entry; |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
#sub move_video { |
313
|
|
|
|
|
|
|
# my ( $this, %params ) = @_; |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
# my $playlistLink = |
316
|
|
|
|
|
|
|
# new WebService::GData::YouTube::Feed::PlaylistLink( {}, |
317
|
|
|
|
|
|
|
# $this->{_request} ); |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
#delete old one |
320
|
|
|
|
|
|
|
# $playlistLink->playlistId( $params{'from'} ); |
321
|
|
|
|
|
|
|
# $playlistLink->deleteVideo( videoId => $params{'videoid'} ); |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
#put in new one |
324
|
|
|
|
|
|
|
# $playlistLink->playlistId( $params{'to'} ); |
325
|
|
|
|
|
|
|
# $playlistLink->addVideo( videoId => $params{'videoid'} ); |
326
|
|
|
|
|
|
|
#} |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
#standard feeds |
329
|
2
|
|
|
2
|
|
17
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
767
|
|
330
|
|
|
|
|
|
|
foreach my $stdfeed ( |
331
|
|
|
|
|
|
|
qw(top_rated |
332
|
|
|
|
|
|
|
top_favorites |
333
|
|
|
|
|
|
|
most_viewed |
334
|
|
|
|
|
|
|
most_shared |
335
|
|
|
|
|
|
|
most_popular |
336
|
|
|
|
|
|
|
most_recent |
337
|
|
|
|
|
|
|
most_discussed |
338
|
|
|
|
|
|
|
most_responded |
339
|
|
|
|
|
|
|
recently_featured |
340
|
|
|
|
|
|
|
on_the_web) |
341
|
|
|
|
|
|
|
) |
342
|
|
|
|
|
|
|
{ |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
*{ __PACKAGE__ . '::get_' . $stdfeed . '_videos' } = sub { |
345
|
0
|
|
|
0
|
|
|
my ( $this, $region, $category, $time ) = @_; |
346
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'standardfeeds/'; |
348
|
0
|
0
|
|
|
|
|
$uri .= $region . '/' if $region; |
349
|
0
|
|
|
|
|
|
$uri .= $stdfeed; |
350
|
0
|
0
|
|
|
|
|
$uri .= '_' . $category if $category; |
351
|
0
|
0
|
|
|
|
|
$this->query->time($time) if $time; |
352
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
353
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
|
my $playlists = |
355
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
356
|
0
|
|
|
|
|
|
return $playlists->entry; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
foreach my $feed (qw(comments responses related)) { |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
*{ __PACKAGE__ . '::get_' . $feed . '_for_video_id' } = sub { |
363
|
0
|
|
|
0
|
|
|
my ( $this, $id ) = @_; |
364
|
|
|
|
|
|
|
|
365
|
0
|
|
|
|
|
|
my $uri = $this->{_baseuri} . 'videos/' . $id . '/' . $feed; |
366
|
0
|
|
|
|
|
|
my $res = $this->{_request}->get($uri); |
367
|
|
|
|
|
|
|
|
368
|
0
|
|
|
|
|
|
my $playlists = |
369
|
|
|
|
|
|
|
new WebService::GData::YouTube::Feed( $res, $this->{_request} ); |
370
|
0
|
|
|
|
|
|
return $playlists->entry; |
371
|
|
|
|
|
|
|
} |
372
|
|
|
|
|
|
|
} |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
"The earth is blue like an orange."; |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
__END__ |