line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Video::Collegehumor; |
2
|
1
|
|
|
1
|
|
450
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has media_id => sub { shift->url->path =~ m!/(\d+)/! ? $1 : '' }; |
5
|
0
|
|
|
0
|
1
|
|
sub provider_name {'Collegehumor'} |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub learn { |
8
|
0
|
|
|
0
|
1
|
|
my ($self, $c, $cb) = @_; |
9
|
|
|
|
|
|
|
|
10
|
0
|
0
|
|
|
|
|
if ($self->media_id) { |
11
|
0
|
|
|
|
|
|
$self->$cb; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
else { |
14
|
0
|
|
|
|
|
|
$self->SUPER::learn($c, $cb); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub to_embed { |
21
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
22
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::to_embed; |
23
|
0
|
|
|
|
|
|
my $src = Mojo::URL->new('http://www.collegehumor.com/e'); |
24
|
0
|
|
|
|
|
|
my %args = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
push @{$src->path}, $media_id; |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->_iframe( |
29
|
|
|
|
|
|
|
src => $src, |
30
|
|
|
|
|
|
|
class => 'link-embedder video-collegehumor', |
31
|
|
|
|
|
|
|
width => $args{width} || 600, |
32
|
0
|
|
0
|
|
|
|
height => $args{height} || 369 |
|
|
|
0
|
|
|
|
|
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding utf8 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Video::Collegehumor - collegehumor.com link |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This class inherit from L. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 media_id |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Returns the the digit from the second path part from L. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 provider_name |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 learn |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 to_embed |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Returns the HTML code for an iframe embedding this movie. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Marcus Ramberg |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |