The Pirate Bay Scraper / Bot
18 07 2009I heard the news - The Pirate Bay has been purchased for $7.7 Million. So, I decided it would be a cool idea to scrape all the torrent files and archive them. Long story short - I coded a PHP / MySQL scraper that just follows links on TPB and downloads Torrents as it find them. It is pretty simple.
This fantastic package can be yours right now for a small donation *hint hint wink wink*. Not really, but it would be nice
I did have the scrapers live stats up, but my hosting company wont let me. The script also has a nifty search / download page:
Thanks!
UPDATE:
You can download a .rar file from my site here, or you can help spread the work by downloading it via bit-torrent from The Pirate Bay.
Description From TPB:
The Pirate Bay Torrent Scraper
**This is Version 1.1**
* Fixed MySQL connections issue. MySQL now closes connections correctly.
*View Live working demo at http://iluvjohn.com/scripts/tpb/torrent.php
I will be Seeding for a long time….only 2.93 MB!
IMPORTANT NOTE:
In torrent.php there are 2 urls you need to change so that you don’t go to my site.
just strip out “http://iluvjohn.com/scripts/tpb/” and you should be fine.
Sorry about that…..didn’t realize it at first.
This is a script I have been writing for about 2 days now. I figured since TPB got bought, we should ensure ourselves access to the torrents the we the people have taken the time to create.
This script requires PHP, MySQL and Curl.
This script comes with:
*An install.php file that will set up your database.
*index.php will scan and scrape TPB for torrents, following links much like a bot does.
*index.php will save .torrent files that originate from torrents.thepiratebay.org only.
*When index.php finds a torrent it checks to make sure its not already in the DB, Saves the Torrent file in the DB, saves the URL in which the torrent was located, and saves the entire page that the torrent file was found on (preserving the description / info of the torrent file).
*torrents.php file will allow anyone to see the stats of the scraper, as well as search through torrent names and download torrent files.
*If people like this script, I’d consider releasing updates. If you want to add to it / mod it, by all means go for it!! Feel free to send it to me to check out too!!
I feel there is a bit of a press for time regarding TPB, so I wanted to get this out there ASAP, even if it is a little bit crude.
I have tested this on windows and linux servers. If you are planning on running it from home, I suggest dedicating an entire whole computer to this - It will take a bit of HD space, and also processing will start to rise drastically as the database fills up as this app is primarily database driven.
Contact me via: http://iluvjohn.com/contact.php
Or comment for others (if you really like the script) here: http://iluvjohn.com/2009/07/18/the-pirate-bay-scraper-bot/
Written by: John Minton
Comments : 17 Comments »Categories : PHP MySQL Curl






