EvilZone
Programming and Scripting => Other => : Doddy February 14, 2014, 07:11:24 PM
-
A simple Delphi program to search for torrents on PirateBay.
An image :
(http://doddyhackman.webcindario.com/images/piratebaydelphi.jpg)
The source :
// PirateBay Manager 0.8
// (C) Doddy Hackman 2014
unit pirate;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, PerlRegEx, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP, ComCtrls, sListView, sGroupBox, sListBox, ShellApi,
sSkinManager, acPNG, ExtCtrls, sStatusBar, sEdit, sButton;
type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
PerlRegEx1: TPerlRegEx;
sGroupBox1: TsGroupBox;
sListView1: TsListView;
sListBox1: TsListBox;
sListBox2: TsListBox;
sListBox3: TsListBox;
PerlRegEx2: TPerlRegEx;
sSkinManager1: TsSkinManager;
Image1: TImage;
sGroupBox2: TsGroupBox;
sEdit1: TsEdit;
sStatusBar1: TsStatusBar;
sButton1: TsButton;
procedure sListView1DblClick(Sender: TObject);
procedure sButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
sSkinManager1.SkinDirectory := ExtractFilePath(Application.ExeName) + 'Data';
sSkinManager1.SkinName := 'tv-b';
sSkinManager1.Active := True;
end;
procedure TForm1.sButton1Click(Sender: TObject);
var
busqueda: string;
code: string;
nombre: string;
link_torrent: string;
limpiando_data: string;
data: string;
seeders: string;
leechers: string;
i: integer;
begin
sListBox1.Clear;
sListBox2.Clear;
sListBox3.Clear;
sListView1.Clear;
busqueda := sEdit1.Text;
busqueda := StringReplace(busqueda, ' ', '%20', [rfReplaceAll, rfIgnoreCase]);
sStatusBar1.Panels[0].Text := '[+] Searching ...';
sStatusBar1.Update;
code := IdHTTP1.Get('http://thepiratebay.se/search/' + busqueda + '/0/99/0');
sStatusBar1.Panels[0].Text := '[+] Finished';
sStatusBar1.Update;
PerlRegEx1.Regex :=
'(.*?)class="detLink" title="Details for (.*?)">(.*?)<a href="magnet(.*?)" title="Download this torrent using magnet"(.*?)<font class="detDesc">(.*?)<\/font>(.*?)<td align="right">(.*?)<\/td>(.*?)<td align="right">(.*?)<\/td>(.*?)';
PerlRegEx1.Subject := code;
while PerlRegEx1.MatchAgain do
// if PerlRegEx1.Match then
begin
nombre := PerlRegEx1.SubExpressions[2];
link_torrent := 'magnet' + PerlRegEx1.SubExpressions[4];
limpiando_data := PerlRegEx1.SubExpressions[6];
seeders := PerlRegEx1.SubExpressions[8];
leechers := PerlRegEx1.SubExpressions[10];
PerlRegEx2.Regex := '(.*), ULed by <';
PerlRegEx2.Subject := limpiando_data;
if PerlRegEx2.Match then
begin
limpiando_data := PerlRegEx2.SubExpressions[1];
data := StringReplace(limpiando_data, ' ', '', [rfReplaceAll,
rfIgnoreCase]);
data := data + ', Seeders ' + seeders + ', Leechers ' + leechers;
end;
sListBox1.Items.Add(nombre);
sListBox2.Items.Add(data);
sListBox3.Items.Add(link_torrent);
end;
for i := 0 to sListBox1.Count - 1 do
begin
// ShowMessage(IntToStr(i));
with sListView1.Items.Add do
begin
Caption := sListBox1.Items[i];
SubItems.Add(sListBox2.Items[i]);
end;
end;
end;
procedure TForm1.sListView1DblClick(Sender: TObject);
begin
// ShowMessage(sListBox3.Items[sListView1.Selected.Index]);
ShellExecute(0, nil, PChar(sListBox3.Items[sListView1.Selected.Index]), nil,
nil, SW_SHOWNORMAL);
end;
end.
// The End ?
Available for download here (https://sourceforge.net/projects/piratebaymanager/).
-
Great share Doddy! +1
If you don't mind I have a couple of suggestions to help improve your app!
1. Add ability to add a socks proxy for those who have tpb blocked in their country
2. Add other public trackers such as kickasstorrents
3. Maybe an input to allow private trackers
4. Maybe an ssh tunnel option as well as a VPN/OpenVPN option
5. Ability to interface with seedbox server (something like a transdroid desktop app)
If I'd be able to use this to connect to my private trackers and add torrents to my seedbox it would be a very useful application to a lot of torrenters. We could search all of our sites. It would be awesome!
-
Great effort, +1. However it's not exactly useful unless you make it search multiple sites to save time :)
It's so nice to see Delphi code, it has been some time since I last opened a delphi project :D
Btw why still Delphi? I have left it behind many years ago...
-
thanks for the suggestions.
Kulverstukas, that language would have to use? , I have planned to start in C#
-
Interesting, thanks for the share :)
+1