line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Video::Blip; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Video::Blip - blip.tv link |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
L |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This class inherit from L. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
568
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head2 provider_name |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
1
|
|
sub provider_name {'Blip'} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 learn |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Will fetch the L and extract the L. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub learn { |
34
|
0
|
|
|
0
|
1
|
|
my ($self, $c, $cb) = @_; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$self->{ua}->get( |
37
|
|
|
|
|
|
|
$self->url, |
38
|
|
|
|
|
|
|
sub { |
39
|
0
|
|
|
0
|
|
|
my ($ua, $tx) = @_; |
40
|
0
|
|
|
|
|
|
my $tag = $tx->res->dom->at('[data-analytics="embed"]'); |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
0
|
|
|
|
if ($tag and $tag->{'data-cliptext'}) { |
|
|
0
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
# |
46
|
0
|
0
|
|
|
|
|
$self->media_id($1) if $tag->{'data-cliptext'} =~ m!play/([^\?]+)!; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
elsif ($tx->res->body =~ m!blip\.tv/play/([^\?]+)!) { |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# http://blip.tv/play/ab.c?p=1 |
51
|
0
|
|
|
|
|
|
$self->media_id($1); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else { |
54
|
0
|
|
|
|
|
|
my $dom = $tx->res->dom; |
55
|
0
|
0
|
|
|
|
|
$self->_tx($tx)->_learn_from_dom($dom) if $dom; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$self->$cb; |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 to_embed |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns the HTML code for an iframe embedding this movie. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub to_embed { |
72
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
73
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::to_embed; |
74
|
0
|
|
|
|
|
|
my %args = @_; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
0
|
|
|
|
$self->tag( |
|
|
|
0
|
|
|
|
|
77
|
|
|
|
|
|
|
iframe => src => "http://blip.tv/play/$media_id?p=1", |
78
|
|
|
|
|
|
|
class => 'link-embedder video-blip', |
79
|
|
|
|
|
|
|
width => $args{width} || 720, |
80
|
|
|
|
|
|
|
height => $args{height} || 433, |
81
|
|
|
|
|
|
|
frameborder => 0, |
82
|
|
|
|
|
|
|
allowfullscreen => undef, |
83
|
|
|
|
|
|
|
webkitAllowFullScreen => undef |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Marcus Ramberg |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |