Colab enforces its ban on peer-to-peer file sharing by terminating the runtime once torrent traffic is detected, so the pipeline never completes a batch. The disk problem the batching design solves was never the blocker; host policy enforcement is. README, notebook intro/notes, and both docs now lead with the failure and point at a VPS or seedbox instead. Removes the Colab badge so the notebook is not one click from running. No code changes.
torrent2drive
This does not work. Do not use it.
Google Colab terminates the runtime when it detects torrent traffic. Downloading torrents is prohibited by Colab's FAQ, and the prohibition is enforced, not just written down — the runtime is killed mid-download, so the notebook never gets far enough to upload anything. The batching design below is sound on paper and irrelevant in practice, because the host stops the process.
This repository is kept as a record of an approach that was tried and failed. Use a VPS or a seedbox instead.
An attempt at a single Google Colab notebook that downloads a torrent inside a Colab runtime and uploads it to Google Drive in batches, so the torrent's total size never has to fit on the runtime's local disk.
What actually happened
The disk problem was solvable and was solved — the sliding-window design below keeps peak local disk at a fixed budget regardless of torrent size. That was never the blocker.
The blocker is policy enforcement. Colab prohibits "downloading torrents or engaging in peer-to-peer file-sharing" from its runtimes, and that restriction is about the activity, not the content: it applies even to a torrent you have every right to download. In practice the runtime gets killed once the download is under way, so the pipeline cannot complete a single batch reliably. Repeated attempts also put the Google account at risk.
There is no fix inside the notebook. Obfuscating the traffic to evade detection would still breach the terms, so it is not a direction this repo will take.
The working answer is a cheap VPS or seedbox. It removes the disk cap, the 12-hour session cap, and the terms problem in one move, and it can seed afterwards — which this notebook could never do.
What was built anyway
For anyone reading the code as a reference rather than a tool:
- Magnet links and
.torrentfiles via the libtorrent Python bindings. - A per-file sliding window: every file starts at libtorrent priority
0, and the pipeline repeatedly takes the next group of files fittingDISK_BUDGET_GB, downloads only those, uploads them, deletes them locally, and drops the priorities back. Peak local disk is the budget, not the torrent size. The one hard limit is that the largest single file must fit in the budget. - Resumable chunked uploads straight to the Drive REST API, with size verification before any local
file is deleted. No
drive.mount: Colab's Drive FUSE mount stages content in/root/.config/Google/DriveFS/<id>/content_cacheon the local disk, unbounded and without eviction (colabtools#960), so it would consume the very disk the design exists to avoid. - Restart safety: re-running the pipeline indexes the destination folder and skips every file already in Drive at the correct size.
None of this was ever validated end to end on a live runtime, because the runtime does not survive long enough to validate it.
Other limits, if the terms problem did not exist
- Local disk is roughly 35–78 GB on a free runtime, not 100 GB, and a GPU runtime gets less.
- Session length is capped at 12 hours on the free tier, and idle runtimes are reclaimed sooner.
- Drive storage is 15 GB free; Drive uploads are capped at 750 GB per 24 hours on every account, personal or Workspace.
- No seeding. The notebook deletes each file once it is in Drive and could not serve a request for it, so it never unchokes a peer.
- Magnet resolution can take minutes on poorly seeded torrents and may never succeed from a datacenter IP.
Documentation
- docs/system-architecture.md — the constraint stack behind the design, cell responsibilities, failure handling, and rejected alternatives.
- docs/project-changelog.md — what changed and why, including the point at which the approach was abandoned.
Legal
Only download content you have the right to download. Beyond copyright, note the Colab restriction described at the top of this file — it is the reason this project is archived. This notebook is a general purpose BitTorrent client; what you point it at is your responsibility.
License
MIT — see LICENSE.