No description
  • Python 87.7%
  • PowerShell 12.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-14 20:59:37 +02:00
.gitignore Initial commit 2026-07-14 20:59:37 +02:00
latest_date.txt Initial commit 2026-07-14 20:59:37 +02:00
README.md Initial commit 2026-07-14 20:59:37 +02:00
requirements.txt Initial commit 2026-07-14 20:59:37 +02:00
run.ps1 Initial commit 2026-07-14 20:59:37 +02:00
torrent_grab.py Initial commit 2026-07-14 20:59:37 +02:00

TorrentGrab

A small Python tool that downloads all .torrent files from Nyaa Books (https://nyaa.si/?f=0&c=3_1&q=), starting from a tracked date, and updates a simple text file so it can resume where it left off next time.

Features

  • Walks Nyaa pages in date-descending order
  • Downloads the .torrent link for each row newer than the saved date
  • Persists the latest processed date in latest_date.txt
  • Safe to re-run: skips already-downloaded torrents and stops once it reaches previously processed dates

Requirements

  • Python 3.10+
  • Install dependencies:
python -m pip install -r requirements.txt

Usage

Run from the project folder:

.\run.ps1 --out .\downloads --state .\latest_date.txt

run.ps1 creates a local .venv, installs the packages from requirements.txt, and forwards any arguments to the Python script. If PowerShell blocks local scripts, run it with:

powershell -ExecutionPolicy Bypass -File .\run.ps1 --out .\downloads --state .\latest_date.txt

Optional flags:

  • --start-date "YYYY-MM-DD HH:MM" used only if the state file does not exist. Defaults to 2025-10-20 00:00 (from your screenshot).
  • --max-pages <N> limit pages scanned per run (omit to scan until the resume boundary).

The tool saves .torrent files into downloads/ and keeps the most recent processed datetime in latest_date.txt. On the next run, it only grabs rows newer than that datetime and stops when it reaches older ones.

Backfill: older than a date

To grab torrents strictly before a boundary date (e.g., your saved latest_date.txt) and resume going further back in time:

python .\torrent_grab_before.py --out .\downloads --boundary-state .\latest_date.txt --state .\earliest_date.txt
  • --boundary-state points to the file that holds the “newer-side” boundary (normally latest_date.txt). Rows must be strictly older than this date.
  • --state stores the earliest processed date (default earliest_date.txt) so re-runs continue even further back without redownloading.
  • --max-pages <N> can cap how many pages you backfill per run.

On first backfill run, if earliest_date.txt does not exist, it initializes to the boundary date and downloads all rows before it. After completing, it updates earliest_date.txt to the oldest date seen so the next run goes even older.

Notes

  • This tool extracts the Date column via regex YYYY-MM-DD HH:MM and the .torrent file via the download icon link.
  • If Nyaa changes its markup, minor adjustments may be required.