- Python 87.7%
- PowerShell 12.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitignore | ||
| latest_date.txt | ||
| README.md | ||
| requirements.txt | ||
| run.ps1 | ||
| torrent_grab.py | ||
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
.torrentlink 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 to2025-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-statepoints to the file that holds the “newer-side” boundary (normallylatest_date.txt). Rows must be strictly older than this date.--statestores the earliest processed date (defaultearliest_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:MMand the.torrentfile via the download icon link. - If Nyaa changes its markup, minor adjustments may be required.