line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- mode: perl; coding: utf-8 -*- |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package WWW::NicoVideo::URL; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
7
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
8
|
1
|
|
|
1
|
|
5
|
use URI; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
9
|
1
|
|
|
1
|
|
30
|
use URI::Escape; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
10
|
1
|
|
|
1
|
|
10
|
use base qw[Exporter]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
321
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw[nicoURL]; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %NICO_URL = (top => "http://www.nicovideo.jp/", |
15
|
|
|
|
|
|
|
base => "http://www.nicovideo.jp/", |
16
|
|
|
|
|
|
|
recent => "http://www.nicovideo.jp/recent", |
17
|
|
|
|
|
|
|
newarrival => "http://www.nicovideo.jp/newarrival", |
18
|
|
|
|
|
|
|
img => "http://res.nicovideo.jp/img/tpl/head/logo/rc.gif", |
19
|
|
|
|
|
|
|
login => "https://secure.nicovideo.jp/secure/login?site=niconico", |
20
|
|
|
|
|
|
|
fmt => "http://www.nicovideo.jp/%s/%s"); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub nicoURL |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
0
|
0
|
|
my $type = shift; |
25
|
0
|
|
|
|
|
|
my @keys = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
0
|
|
|
|
$type = "top" if(!$type and !@keys); |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
0
|
|
|
|
if(defined $type and @keys) { |
|
|
0
|
0
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $keys = join " ", @keys; |
31
|
0
|
0
|
|
|
|
|
utf8::encode($keys) if(utf8::is_utf8($keys)); |
32
|
0
|
|
|
|
|
|
return new URI(sprintf($NICO_URL{fmt}, $type, uri_escape($keys))); |
33
|
|
|
|
|
|
|
} elsif(defined $type and defined $NICO_URL{$type}) { |
34
|
0
|
|
|
|
|
|
return new URI($NICO_URL{$type}); |
35
|
|
|
|
|
|
|
} else { |
36
|
0
|
|
|
|
|
|
confess "Invalid type: $type (keys = @keys)"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
"Ritsuko"; |