WWW::Mechanize::Tor - rotate your ips
version 0.01
use WWW::Mechanize::Tor; my $mech = WWW::Mechanize::Tor->new( tor_control_port => 9051, # empty port on default range(49152 .. 65535) tor_port => 9050, # empty port on default range(49152 .. 65535) tor_ip => '127.0.0.1', # localhost on default tor_config => 'path/to/torrc', # tor default config path ); if ($mech->rotate_ip) { say 'got another ip'; } else { say 'Try again?'; }
Inherits directly form LWP::UserAgent::Tor instead of LWP::UserAgent. Launches tor proc in background and connects to it via socket. Every method call of rotate_ip will send a request to change the exit node and return 1 on sucess.
rotate_ip
$mech->rotate_ip;
Try to get another exit node via tor. Returns 1 for success and 0 for failure.
Inspired by a script of ac0v overcoming some limitations (no more!) of web scraping...
This is released under the Artistic License.
spebern <bernhard@specht.net>
To install WWW::Mechanize::Tor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Mechanize::Tor
CPAN shell
perl -MCPAN -e shell install WWW::Mechanize::Tor
For more information on module installation, please visit the detailed CPAN module installation guide.