| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Crawl4AI::Strategy::Proxy; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Crawl4AI strategy routing through a configured proxy |
|
3
|
2
|
|
|
2
|
|
10
|
use Moo; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
8
|
|
|
4
|
2
|
|
|
2
|
|
556
|
use WWW::Crawl4AI::Request (); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
312
|
|
|
5
|
|
|
|
|
|
|
with 'WWW::Crawl4AI::Strategy'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
11
|
|
|
11
|
1
|
20
|
sub name { 'crawl4ai_proxy' } |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
1
|
0
|
sub cost_class { 'paid' } |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub applicable { |
|
17
|
6
|
|
|
6
|
1
|
11
|
my ( $self, $crawler ) = @_; |
|
18
|
6
|
100
|
|
|
|
13
|
return $crawler->proxy_url ? 1 : 0; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub build_request { |
|
23
|
0
|
|
|
0
|
0
|
|
my ( $self, $crawler, $url ) = @_; |
|
24
|
0
|
|
|
|
|
|
return $self->_request( |
|
25
|
|
|
|
|
|
|
$url, |
|
26
|
|
|
|
|
|
|
browser => { |
|
27
|
|
|
|
|
|
|
enable_stealth => WWW::Crawl4AI::Request::JSON_true(), |
|
28
|
|
|
|
|
|
|
user_agent_mode => 'random', |
|
29
|
|
|
|
|
|
|
proxy_config => { server => $crawler->proxy_url }, |
|
30
|
|
|
|
|
|
|
}, |
|
31
|
|
|
|
|
|
|
crawler => { wait_until => 'networkidle' }, |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |