| 1 | package WWW::FreeProxy::Samair; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use LWP::Simple; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | =head1 FUNCTIONS | ||||||||||
| 6 | |||||||||||
| 7 | =head2 fetch | ||||||||||
| 8 | |||||||||||
| 9 | Fetches proxy list | ||||||||||
| 10 | |||||||||||
| 11 | =cut | ||||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub fetch { | ||||||||
|
Subroutine
fetch: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 14 | 0 | my ($self, $callback) = @_; | |||||||||
| 15 | 0 | for (1 .. 10) { | |||||||||
| 16 | 0 | (my $p = $_) =~ s/^\d$/0$&/; | |||||||||
| 17 | 0 | my $c = get "http://www.samair.ru/proxy/proxy-$p.htm"; | |||||||||
| 18 | 0 | $c =~ s{<script type="text/javascript">}{<script>}g; | |||||||||
| 19 | 0 | $c =~ m{<script>\s*((\w=\d;)+)</script>}s; | |||||||||
| 20 | 0 | my ($s, %h) = $1; | |||||||||
| 21 | 0 | ▶ | $h{$1} = $2 while $s =~ /(\w)=(\d)/g; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | ▶ | while ($c =~ m{<td>((?:\d+\.){3}\d+)<script>document\.write\(":"((?:\+\w)+)\)</script>}g) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | my ($i, $n, $r) = ($1, $2); | |||||||||
| 24 | 0 | ▶ | $r .= $h{$1} while $n =~ /\+(\w)/g; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | &$callback("$i:$r"); | |||||||||
| 26 | } | ||||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 1 | 1; | |||||||||
| 31 | |||||||||||
| 32 | =head1 COPYRIGHT & LICENSE | ||||||||||
| 33 | |||||||||||
| 34 | Copyright 2008 Alexey Alexandrov, all rights reserved. | ||||||||||
| 35 | |||||||||||
| 36 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 37 | under the same terms as Perl itself. | ||||||||||
| 38 | |||||||||||
| 39 | =cut | ||||||||||