A modern, self-hosted torrent search and streaming platform using The Pirate Bay & YTS database dumps, Flask API, Tailwind UI, and browser-based WebTorrent streaming.
- Fast full-text search (FTS5) over millions of torrents.
- Modern UI with category quick-search buttons.
- Streamable magnet/torrent links with browser-based WebTorrent.
- Automatic detection of streamable files and peer status.
- Disaster recovery via downloadable TPB/YTS database snapshots.
brew install aria2 # optional: enables torrent download of the DB dump
./setup.sh # provisions venv + tpb.sqlite + FTS5 index (self-contained)
./serve.sh # runs on http://localhost:3000setup.sh is self-contained and safe to re-run:
- Creates a Python
venvand installsrequirements.txt. - Provisions
tpb.sqliteif missing — extracts a local*.7zbackup if one is present, otherwise downloads viaaria2cwhen aMAGNETURL is supplied:MAGNET="magnet:?xt=..." ./setup.sh. - (Re)builds the FTS5 search index and prints timing for each step.
| Step | Time |
|---|---|
Extract .7z → tpb.sqlite |
~2 min (128s) |
| FTS5 index rebuild | ~6 min (367s) |
| Total fresh build | ~8.3 min |
Verified: SELECT count(*) FROM torrents returns 8,569,954, PRAGMA integrity_check returns ok, and the Flask app boots on :3000 (HTTP 200).
git clone https://github.com/yourusername/torrentmore.git
cd torrentmore- Visit thepiratebay.org user:123dw for the latest “The Pirate Bay & YTS - Full Database Backup”.
- Download the most recent
.sqliteor.sqlite.7zfile. - Extract if needed, and place it as
tpb.sqlitein the project root.
If this is a fresh install or after restoring a backup, run the FTS5 migration:
sqlite3 tpb.sqlite < fts5_migration_v2.sqlThis will (re)create the FTS5 virtual table for fast search.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtexport FLASK_APP=app.py
flask runOr use your preferred WSGI server.
If needed, use Python’s HTTP server for local development:
python3 -m http.server 3000- Download the latest TPB/YTS backup from the trusted user (e.g., 123dw).
- Replace your
tpb.sqlitewith the new backup. - Re-run the FTS5 migration (
fts5_migration_v2.sql) to ensure search works. - Restart the Flask app and static server.
- Test search and streaming to verify recovery.
- Always use the most recent backup (they are semi-monthly).
- You can automate checking for new backups by scraping the user’s TPB page and comparing file dates/hashes.
- FTS5 index must be rebuilt after every new backup or restore.
- Download and extract the new
.sqlitefile. - Replace
tpb.sqlite. - Run:
sqlite3 tpb.sqlite < fts5_migration_v2.sql - Restart your app.
- No user authentication by default.
- No analytics or tracking.
- All search and streaming is local to your server and browser.
- Browser streaming only works if there are WebRTC peers (see README section on streaming limitations).
- No persistent torrent downloads in browser; refresh = redownload.
- Codec support depends on browser capabilities.
- Scrape thepiratebay.org/search.php?q=user:123dw for the latest backup.
- Download if newer than your current
tpb.sqlite. - Automate FTS5 rebuild and app restart.
- Backups are external and versioned: You can always restore from any point-in-time backup.
- Stateless app: All logic is in code or database; no hidden state.
- FTS5 rebuild is deterministic: As long as you have a valid backup and migration script, you can always restore search functionality.
PRs welcome! Please document any new migration or backup steps.
MIT (or your preferred license).