| 1 | #!/usr/bin/perl | ||
| 2 | #use strict; | ||
| 3 | use WWW::BitTorrent; | ||
| 4 | |||
| 5 | my ($user, $pass) = ('username', 'password'); | ||
| 6 | |||
| 7 | my $site = 'http://www.BitTorrentBoard.com'; | ||
| 8 | |||
| 9 | my $client = WWW::BitTorrent->new( 'site' => $site, 'user' => $user, 'pass' => $pass); | ||
| 10 | |||
| 11 | if ($client->{STAT} == 0) { | ||
| 12 | print "ERROR: " . $client->{ERROR}."\n"; | ||
| 13 | exit; | ||
| 14 | } | ||
| 15 | |||
| 16 | my @page; | ||
| 17 | |||
| 18 | #@page = $client->browse(1); | ||
| 19 | |||
| 20 | @page = $client->search('keyword'); | ||
| 21 | |||
| 22 | die("Error occured calling browse or page is empty\n") if ($#page == -1); | ||
| 23 | |||
| 24 | my $download; | ||
| 25 | |||
| 26 | foreach my $row (@page) { | ||
| 27 | |||
| 28 | if ($row->{name} =~ /S01/) { | ||
| 29 | $download = $row; | ||
| 30 | } | ||
| 31 | |||
| 32 | print "Rls: " . $row->{name} . "- id: " . $row->{id} ."\n"; | ||
| 33 | } | ||
| 34 | |||
| 35 | $client->download_torrent($download, "~/file.torrent"); | ||
| 36 |