torfiles icon indicating copy to clipboard operation
torfiles copied to clipboard

An open-source torrent searching serice

TorFiles — An open-source search engine for finding files within torrents.

Build Status

TorFiles is an open-source, self-hostable service for storing, sharing, and searching not just torrents, but all files within the torrents.

You can now search for:

  • Specific songs within discography torrents: beck sunday sun.
  • Specific episodes of shows: Frasier s04e11. screen 1

It features:

  • A clean search interface, that searches every file of every torrent, sorting automatically by peers and size.
  • Uses the DHT crawler p2pspider to build a library of torrents and their peer counts.

Tech used:

Installation

Requirements

  • Java 8 + Maven
  • Node + npm, nvm is the preferred installation method.
  • Angular-cli, run npm i -g @angular/cli
  • Postgres 9.5 or higher

Download TorFiles

git clone https://github.com/dessalines/torfiles

Setup a postgres database

psql -c "create user torfiles with password 'asdf' superuser;" -U postgres
psql -c "create database torfiles with owner torfiles;" -U postgres

Or here are some instructions to get your DB up and running.

Edit your pom.xml file to point to your database

cd torfiles
vim service/pom.xml

Edit it to point to your own database:

<!--The Database location and login, here's a sample-->
<jdbc.url>jdbc:postgresql://127.0.0.1/torfiles</jdbc.url>
<jdbc.username>torfiles</jdbc.username>
<jdbc.password>asdf</jdbc.password

Install TorFiles

Running locally:

./install_dev.sh and goto http://localhost:4567/

for a production environment:

  • Edit ui/config/environment.prod.ts to point to your hostname
  • Create a (.jks) file with your ssl certs, put it in your home directory, @ keystore.jks
  • Run ./install_prod.sh -ssl KEYSTORE.JKS

You can redirect ports in linux to route from port 443, or 80 to this port:

sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4567

Install p2pSpider

git clone https://github.com/dessalines/p2pspider
cd p2pspider
vim index.js

Edit the client to point to your DB:

const client = new Client({
  user: 'torfiles',
  host: 'localhost',
  database: 'torfiles',
  password: 'asdf',
});

Run p2pSpider:

npm i
node index.js

Or use pm2 to start multiple instances of it, to crawl faster:

npm i -g pm2
pm2 start index.js -i 5

This will start running p2pspider, which crawls the DHT to download torrents and peers, and saves them to your database. It will take a few days for your database to fill up.


Bugs and feature requests

Have a bug or a feature request? If your issue isn't already listed, then open a new issue here.