| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Crawl4AI::Attempt; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: one strategy attempt in a WWW::Crawl4AI fallback chain |
|
3
|
3
|
|
|
3
|
|
99626
|
use Moo; |
|
|
3
|
|
|
|
|
6851
|
|
|
|
3
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has backend => ( is => 'ro', required => 1 ); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has cost_class => ( is => 'ro', default => sub { 'cheap' } ); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has ok => ( is => 'ro', default => sub { 0 } ); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has page => ( is => 'ro' ); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has signals => ( is => 'ro', default => sub { {} } ); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has why_failed => ( is => 'ro' ); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has error => ( is => 'ro' ); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has elapsed => ( is => 'ro' ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub to_hash { |
|
33
|
5
|
|
|
5
|
1
|
260115
|
my ( $self ) = @_; |
|
34
|
5
|
|
50
|
|
|
14
|
my $page = $self->page || {}; |
|
35
|
|
|
|
|
|
|
return { |
|
36
|
|
|
|
|
|
|
backend => $self->backend, |
|
37
|
|
|
|
|
|
|
cost_class => $self->cost_class, |
|
38
|
|
|
|
|
|
|
ok => $self->ok ? \1 : \0, |
|
39
|
|
|
|
|
|
|
status_code => $page->{status_code}, |
|
40
|
|
|
|
|
|
|
final_url => $page->{final_url} // $page->{url}, |
|
41
|
5
|
100
|
66
|
|
|
153
|
markdown_len => defined $page->{markdown} ? length $page->{markdown} : 0, |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
signals => $self->signals, |
|
43
|
|
|
|
|
|
|
why_failed => $self->why_failed, |
|
44
|
0
|
|
|
|
|
|
( defined $self->error ? ( error => "@{[ $self->error ]}" ) : () ), |
|
45
|
|
|
|
|
|
|
( defined $self->elapsed ? ( elapsed => $self->elapsed ) : () ), |
|
46
|
|
|
|
|
|
|
}; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
1
|
|
sub TO_JSON { $_[0]->to_hash } |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |