line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Pornhub; |
2
|
2
|
|
|
2
|
|
67089
|
use v5.14.0; |
|
2
|
|
|
|
|
19
|
|
3
|
2
|
|
|
2
|
|
1003
|
use Moo; |
|
2
|
|
|
|
|
20331
|
|
|
2
|
|
|
|
|
9
|
|
4
|
2
|
|
|
2
|
|
3411
|
use namespace::clean; |
|
2
|
|
|
|
|
20218
|
|
|
2
|
|
|
|
|
12
|
|
5
|
2
|
|
|
2
|
|
1608
|
use Function::Parameters; |
|
2
|
|
|
|
|
6410
|
|
|
2
|
|
|
|
|
9
|
|
6
|
2
|
|
|
2
|
|
1762
|
use URI; |
|
2
|
|
|
|
|
10771
|
|
|
2
|
|
|
|
|
68
|
|
7
|
2
|
|
|
2
|
|
884
|
use HTML::Entities qw/decode_entities/; |
|
2
|
|
|
|
|
10666
|
|
|
2
|
|
|
|
|
145
|
|
8
|
2
|
|
|
2
|
|
1250
|
use LWP::UserAgent; |
|
2
|
|
|
|
|
72617
|
|
|
2
|
|
|
|
|
466
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'WebService::Client'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '+base_url' => ( |
15
|
|
|
|
|
|
|
default => 'https://www.pornhub.com/webmasters', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has '+ua' => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
lazy => 1, |
21
|
|
|
|
|
|
|
default => sub { |
22
|
|
|
|
|
|
|
LWP::UserAgent->new( |
23
|
|
|
|
|
|
|
agent => 'WebService::Pornhub/' . $VERSION, |
24
|
|
|
|
|
|
|
timeout => shift->timeout, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
0
|
0
|
1
|
|
method search(%params) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $res = $self->get( $self->_uri( '/search', %params ) ); |
31
|
0
|
0
|
|
|
|
|
return $res ? $res->{videos} : undef; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
0
|
0
|
1
|
|
method get_video(%params) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $res = $self->get( $self->_uri( '/video_by_id', %params ) ); |
36
|
0
|
0
|
|
|
|
|
return $res ? $res->{video} : undef; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
0
|
0
|
1
|
|
method get_embed_code(%params) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $res = $self->get( $self->_uri( '/video_embed_code', %params ) ); |
41
|
0
|
0
|
|
|
|
|
return undef unless $res; |
42
|
0
|
0
|
|
|
|
|
my $embed = $res->{embed} or return undef; |
43
|
0
|
|
|
|
|
|
$embed->{code} = decode_entities( $embed->{code} ); |
44
|
0
|
|
|
|
|
|
return $embed; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
0
|
0
|
1
|
|
method get_deleted_videos(%params) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
48
|
0
|
|
0
|
|
|
|
$params{page} ||= 1; |
49
|
0
|
|
|
|
|
|
my $res = $self->get( $self->_uri( '/deleted_videos', %params ) ); |
50
|
0
|
0
|
|
|
|
|
return $res ? $res->{videos} : undef; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
0
|
0
|
1
|
|
method is_video_active(%params) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $res = $self->get( $self->_uri( '/is_video_active', %params ) ); |
55
|
0
|
0
|
|
|
|
|
return $res ? $res->{active} : undef; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
0
|
1
|
|
method get_categories() { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $res = $self->get('/categories'); |
60
|
0
|
0
|
|
|
|
|
return $res ? $res->{categories} : undef; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
0
|
0
|
1
|
|
method get_tags(%params) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $res = $self->get( $self->_uri( '/tags', %params ) ); |
65
|
0
|
0
|
|
|
|
|
return $res ? $res->{tags} : undef; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
0
|
1
|
|
method get_stars() { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $res = $self->get('/stars'); |
70
|
0
|
0
|
|
|
|
|
return $res ? $res->{stars} : undef; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
0
|
1
|
|
method get_stars_detailed() { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $res = $self->get('/stars_detailed'); |
75
|
0
|
0
|
|
|
|
|
return $res ? $res->{stars} : undef; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
0
|
0
|
|
|
method _uri( $path, %params ) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $uri = URI->new($path); |
80
|
0
|
|
|
|
|
|
for my $key ( keys %params ) { |
81
|
0
|
0
|
|
|
|
|
if ( ref $params{$key} eq 'ARRAY' ) { |
82
|
0
|
|
|
|
|
|
my $v = delete $params{$key}; |
83
|
0
|
|
|
|
|
|
$params{$key} = join ',', @$v; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
0
|
|
|
|
|
|
$uri->query_form(%params); |
87
|
0
|
|
|
|
|
|
return $uri->as_string; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |