WWW::BitTorrent - Search and Download .torrent(s) files from BitTorrents boards.
# Creates WWW::BitTorrent Object.
my $client = WWW::BitTorrent->new( 'site' => $site, 'user' => $user, 'pass' => $pass);
# Check for errors.
if ($client->{STAT} == 0) {
print "ERROR: " . $client->{ERROR}."\n";
exit;
}
# return all rows (from page 1) and prints it
my @page = $client->browse(1);
die("Error occured calling browse or page is empty\n") if ($#page == -1);
foreach my $row (@page) {
print "Row: " . $row->{name} . "- id: " . $row->{id} ."\n";
}
# Search for a row
@page = $client->search('DiAMOND');
die("No Results.\n") if ($#page == -1);
my $download_row;
foreach my $row (@page) {
print "Row: " . $row->{name} . "- id: " . $row->{id} ."\n";
$download_row = $row if ($row->{name} =~ /my.favorite.movie/);
}
# download .torrent file
$client->download_torrent($download_row, '/tmp/' . $download_row->{id} . '.torrent');
"WWW::BitTorrent" provides an object interface to using two BitTorrent
based boards: "TBSource", "BrokenStone" (tell me about
more). This boards are being update every day with files. This module allows
you to search for files in a couple of ways.
NOTE: any use of this module that is illegal is out of my
responsibilty.
This module requires LWP::UserAgent and
LWP::Simple.
new( [ARGS] )
Used to login the Board with the username and password
of the board (all arguments are required) and create a new Object of
the WWW::BitTorrent module.
Arguments:
site- The BitTorrents board URL address.
user- the username for login the board.
pass- the password for login the board.
NOTES: Returns a blessed object anyways.
object->{STAT}: 0 - for error (object->{ERROR} - http code)
1 - for success
browse( $page_number )
Returns a list(array) of all rows(ref) from the the '$page_number' page.
C<page_number>: number between 0 (first page) and max number of pages.
Arguments:
page_number- the number of the page you want the rows from.
search( $keyword )
This method do the same as browse just by the search option at the board.
download_torrent($row, $path)
Download the .torrent file using the LWP::Simple module.
This module was written by Amit Sides
"<amit.sides@gmail.com>"
Copyright (c) 2006 Amit Sides. All rights reserved.
This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.