line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::PasteScsysCoUk; |
2
|
1
|
|
|
1
|
|
2194
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
140
|
use Mojo::Util (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
239
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has media_id => sub { |
6
|
|
|
|
|
|
|
shift->url->path =~ m!^/?(\d+)! ? $1 : ''; |
7
|
|
|
|
|
|
|
}; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
0
|
0
|
|
sub provider_name {'scsys.co.uk'} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub learn { |
12
|
0
|
|
|
0
|
0
|
|
my ($self, $c, $cb) = @_; |
13
|
0
|
0
|
|
|
|
|
my $raw_url = $self->raw_url or return $self->SUPER::learn($c, $cb); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$self->ua->get( |
16
|
|
|
|
|
|
|
$raw_url, |
17
|
|
|
|
|
|
|
sub { |
18
|
0
|
|
|
0
|
|
|
my ($ua, $tx) = @_; |
19
|
0
|
0
|
|
|
|
|
$self->{text} = Mojo::Util::xml_escape($tx->res->body) if $tx->success; |
20
|
0
|
|
|
|
|
|
$self->$cb; |
21
|
|
|
|
|
|
|
}, |
22
|
0
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub raw_url { |
26
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
27
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
Mojo::URL->new("http://paste.scsys.co.uk/$media_id?tx=on"); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |