| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::Video::Embed::Site::Youtube; |
|
2
|
9
|
|
|
9
|
|
4133
|
use Moo; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
43
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
with 'HTML::Video::Embed::Module'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.016000'; |
|
7
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub domain_reg { |
|
10
|
10
|
|
|
10
|
0
|
50
|
return qr/youtube\.com/; |
|
11
|
|
|
|
|
|
|
} |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub process { |
|
14
|
8
|
|
|
8
|
0
|
9
|
my ( $self, $embeder, $uri ) = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
8
|
|
100
|
|
|
27
|
my ( $vid ) = ( $uri->query_param('v') || '' ) =~ m|^([a-zA-Z0-9-_]{11})$|; |
|
17
|
|
|
|
|
|
|
|
|
18
|
8
|
|
|
|
|
353
|
return $self->_process( $embeder, $vid, $uri ); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _process { |
|
22
|
14
|
|
|
14
|
|
18
|
my ( $self, $embeder, $vid, $uri ) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
14
|
100
|
|
|
|
28
|
if ( $vid ){ |
|
25
|
10
|
|
100
|
|
|
28
|
my $timecode = $uri->query_param('t') || $uri->fragment || ''; |
|
26
|
10
|
|
|
|
|
401
|
$vid .= '?rel=0&html5=1'; |
|
27
|
10
|
100
|
66
|
|
|
75
|
if ( |
|
28
|
|
|
|
|
|
|
defined( $timecode ) |
|
29
|
|
|
|
|
|
|
&& ( my @time = $timecode =~ m/(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)/ ) |
|
30
|
|
|
|
|
|
|
){ |
|
31
|
6
|
|
|
|
|
7
|
my $start = 0; |
|
32
|
6
|
100
|
|
|
|
11
|
if ( $time[0] ){ |
|
33
|
|
|
|
|
|
|
#hours |
|
34
|
4
|
|
|
|
|
17
|
$start += 3600 * $time[0]; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
6
|
100
|
|
|
|
21
|
if ( $time[1] ){ |
|
37
|
|
|
|
|
|
|
#mins |
|
38
|
5
|
|
|
|
|
7
|
$start += 60 * $time[1]; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
6
|
50
|
|
|
|
12
|
if ( $time[2] ){ |
|
41
|
|
|
|
|
|
|
#seconds |
|
42
|
6
|
|
|
|
|
9
|
$start += $time[2]; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
6
|
50
|
|
|
|
9
|
if ( $start ){ |
|
45
|
6
|
|
|
|
|
71
|
$vid .= "&start=${start}"; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
10
|
100
|
|
|
|
33
|
my $schema = $embeder->secure ? 'https' : 'http'; |
|
50
|
10
|
|
|
|
|
10
|
return qq||; |
|
|
10
|
|
|
|
|
102
|
|
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
4
|
|
|
|
|
20
|
return undef; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |