line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::Ix; |
2
|
1
|
|
|
1
|
|
616
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has media_id => sub { |
5
|
|
|
|
|
|
|
shift->url->path =~ m!^/?(\w+)! ? $1 : ''; |
6
|
|
|
|
|
|
|
}; |
7
|
|
|
|
|
|
|
|
8
|
0
|
|
|
0
|
1
|
|
sub provider_name {'ix.io'} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub learn { |
11
|
0
|
|
|
0
|
1
|
|
my ($self, $c, $cb) = @_; |
12
|
0
|
0
|
|
|
|
|
my $raw_url = $self->raw_url or return $self->SUPER::learn($c, $cb); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$self->ua->get( |
15
|
|
|
|
|
|
|
$raw_url, |
16
|
|
|
|
|
|
|
sub { |
17
|
0
|
|
|
0
|
|
|
my ($ua, $tx) = @_; |
18
|
0
|
0
|
|
|
|
|
$self->{text} = Mojo::Util::xml_escape($tx->res->body) if $tx->success; |
19
|
0
|
|
|
|
|
|
$self->$cb; |
20
|
|
|
|
|
|
|
}, |
21
|
0
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub pretty_url { |
25
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
26
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::pretty_url; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
Mojo::URL->new("http://ix.io/$media_id/"); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub raw_url { |
32
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
33
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
Mojo::URL->new("http://ix.io/$media_id"); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=encoding utf8 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Text::Ix - ix.io link |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This class inherit from L. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 OUTPUT HTML |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This is an example output: |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$txt |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 media_id |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$str = $self->media_id; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 provider_name |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 METHODS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 learn |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 pretty_url |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Returns a pretty version of the L. The default is to return a cloned |
71
|
|
|
|
|
|
|
version of L. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 raw_url |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Jan Henning Thorsen |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |