Toru, the command line tool designed for anime enthusiasts. Browse the latest releases on nyaa.si or search for specific titles with Toru's intuitive interface. Stream episodes directly from the command line using MPV or your favorite video player or browser. Toru serves the selected anime over localhost, making it as accessible as any HTTP link. It also functions as a convenient torrent client for magnet links. Simplify your streaming and torrenting with Toru.
toru.mp4
Quick install a pre-built binary
export PREFIX="$HOME/bin"
wget "https://github.com/sweetbbak/toru/releases/download/v0.1/toru_$(uname -s)_$(uname -m).tar.gz" -O - | tar -xz
mv toru "${PREFIX}"
on Windows
iwr -Uri "https://github.com/sweetbbak/toru/releases/download/v0.1/toru_Windows_x86_64.zip" -OutFile toru_Windows_x86_64.zip
With Nix
nix profile install github:sweetbbak/toru
Install Go
Install go This project requires go 1.21.7 or higher.go install github.com/sweetbbak/toru/cmd/toru@latest
Build from source
using Go is recommended alongside gup
so that it can be easily updated
git clone https://github.com/sweetbbak/toru.git && cd toru
go build -o toru ./cmd/toru
you can also use the justfile
git clone https://github.com/sweetbbak/toru.git && cd toru
just
or the makefile
git clone https://github.com/sweetbbak/toru.git && cd toru
make build
Using docker
, podman
with the shell.nix
file on non-nixOS distros
this will automatically pull the correct version of Go and install just
so that building is easy.
git clone https://github.com/sweetbbak/toru.git && cd toru
# mount the project directory inside the container
podman run --volume $(pwd):/toru -ti docker.io/nixos/nix:latest
# inside the container run:
cd /toru
nix-shell
just
Run to find your target architecture and platform:
go tool dist list
then use the environment variables GOOS
and GOARCH
before using
the build command.
Example:
GOOS=linux GOARCH=arm64 go build -o toru ./cmd/toru
If you do this feel free to create an issue for a platform reporting how it went So far there is an issue with android and termux as well as arm 6.
if you are on nix or have nix installed you can just use the shell.nix directly and run just
or make
Search for an anime:
toru search -j "one piece" # outputs json
toru search -i "one piece" # search interactively with fzf
the selected torrent will begin playing and once the video player is closed you will have the option to select another episode, make another search query, or to exit.
toru search --latest
toru search "Akuyaku"
If you know the magnet link for the content you can directly download or stream it
toru stream --magnet 'magnet:?xt=urn:btih:1...announce'
toru download --magnet 'magnet:?xt=urn:btih:1...announce'
All of the above outputs a link that you can use to stream the torrent 'http://localhost:8080/stream?ep=torrent_info_hash'
you can treat this link like any other http link and stream it with mpv
or vlc
, download it, use yt-dlp
, or open it in the browser etc...
this can be helpful for geoblocking and for browsing "special" Nyaa sites
toru search --proxy="https://sukebei.nyaa.si" -i
toru search --proxy="https://nyaa.ink.iss" -i
You can use toru to search for anime and other media types and then output the results in multiple formats.
Output in Json and parsing that output with jq
:
toru search --latest --json | jq -r '.[]|.Name,.Magnet'
toru search --json "one piece" > cache.json
toru search --from-json cacne.json --interactive
toru search "akuyaku 99 1080p"
# Outputs:
[Erai-raws] Akuyaku Reijou Level 99 - 01 [1080p][Multiple Subtitle] [ENG][POR-BR][SPA-LA][SPA][ARA][FRE][GER][ITA][RUS]
2024-01-09 07:36:29
Downloads: 1203
[33|0]
Size: 727 MB
magnet:... [ magnet link here ]
# Create a JSON file using toru
toru search --latest --json > out.json
# Here is a simple example of using fzf and toru to create a simple interace to select and play torrents
# you can also replace toru with any CLI bittorrent client
cat out.json | jq '.[].Name' | \
fzf --preview='cat out.json | jq -r ".[{n}]"' \
--bind "enter:execute(cat out.json | jq -r '.[{n}].Magnet')+abort" | \
xargs toru stream --magnet
ZSH
Copy the file _toru
from the completions
directory into your $FPATH
Run echo $FPATH | sed "s/:/\n/g"
to see a list of directories in your $FPATH
OR
run this command in an interactive shell or put this command in you .zshrc
source <(toru init --zsh)
BASH
Place the file _toru_bash
from the completions
directory into your completions path
OR
run this command in an interactive shell or put this command in you .bashrc
source <(toru init --bash)
Important
toru is in a very early development phase! In order to provide a consistent and smooth experience the CLI interface is subject to change. PR's and advice on project sturcture, pkg organization and feedback on the UI of toru is much appreciated.
Currently tested on Linux, Mac and Windows I would much appreciate someone reporting on the functionality on any BSD or Mac Android with termux currently has UDP issues. Idk much about how android works
- Stream anime from torrents
- add Nyaa.si as a source
- add a generic torrent tracker library for Korean and American movies
- package as various formats (AUR, DEB, Flatpak, AppImage, Release binaries)
- ensure compatibility across platforms and aim for consistent compatibility (should work but currently untested)
2024-05-21
- added zsh and bash completions
- support multi-file torrents
2024-03-1
- added
--proxy
which allows use of nyaa proxy sites and sukebi - added the ability to disable ipv6
- sub-command "run" now accepts a trailing search term argument
- add a package for your distro
- fix race condition in UI between progress bar and fzf interface when searching interactively
- Daemonize into the background and listen for commands on a socket (optional for user, sometimes this is annoying)
- Simple torrent client features (download|seed|add magnet|stream|search)
- Add other trackers besides
nyaa.si
- Expand user interface with bubbletea
Fork it!
Create your feature branch: git checkout -b my-new-feature
Commit your changes: git commit -m 'Add some feature'
Push to the branch: git push origin my-new-feature
Submit a pull request 🤘
PR's welcome! This project currently uses Golang 1.22.2
make sure to format go files using gofmt
and alejandra
for nix. I'm likely to reject PR's that are directly to main unless they are small
or are regarding typos, the readme or documentation.
Because scraping is annoying af and it constantly breaks. On top of that, someone is paying for those servers. Torrents are more resistant to takedowns and hopefully will have more longevity.
Nyaa package is modified from here:
Consider creating a PR, taking up a minor issue on the TODO list, leaving an issue to help improve functionality or buy me a coffee!