nyaa.si client library for Go
Built on top of:
gofeed - search using RSS
colly - scrap torrent details page
Original idea:
ejnshtein/nyaa-api
go get github.com/mmcdole/gofeed
go get github.com/gocolly/colly
go get -u github.com/irevenko/go-nyaa
Contributions, issues and feature requests are welcome! 👍
Feel free to check open issues.
Search
returns []Torrent
import (
"fmt"
"log"
"github.com/irevenko/go-nyaa/nyaa"
)
func main() {
opt := nyaa.SearchOptions{
Provider: "nyaa", // Provider is the only required option
Query: "LN",
Category: "literature",
SortBy: "seeders",
Filter: "trusted-only",
}
torrents, err := nyaa.Search(opt)
if err != nil {
log.Fatal(err)
}
fmt.Println(torrents)
}
type SearchOptions struct {
Provider string
Query string
Category string
SortBy string
Filter string
}
nyaa
- nyaa.sisukebei
- sukebei.nyaa.si
- your desired search string
all
- All Categoriesanime
- All Animeanime-amv
anime-eng
anime-non-eng
anime-raw
audio
- All Audioaudio-lossless
audio-lossy
literature
- All Literatureliterature-eng
literature-non-eng
literature-raw
live-action
- All Live Actionlive-action-idol-prom
live-action-eng
live-action-non-eng
live-action-raw
pictures
- All Picturespictures-graphics
pictures-photos
software
- All Softwaresoftware-apps
software-games
all
- All Categoriesart
- All Artart-anime
art-doujinshi
art-manga
art-games
art-pictures
real-life
- All Real Lifereal-life-photos
real-life-videos
comments
downloads
date
seeders
leechers
size
no-filter
no-remakes
trusted-only
TorrentComments
returns []Comment
import (
"fmt"
"log"
"github.com/irevenko/go-nyaa/nyaa"
)
func main() {
comms, err := nyaa.TorrentComments("https://nyaa.si/view/1366002") // nyaa.si or sukebei.nyaa.si
if err != nil {
log.Fatal(err)
}
for _, v := range comms {
fmt.Println("user: " + v.User)
fmt.Println("at: " + v.Date)
fmt.Println("text: " + v.Text)
fmt.Println()
}
}
TorrentDescription
returns string
import (
"fmt"
"log"
"github.com/irevenko/go-nyaa/nyaa"
)
func main() {
desc, err := nyaa.TorrentDescription("https://nyaa.si/view/1366002") // nyaa.si or sukebei.nyaa.si
if err != nil {
log.Fatal(err)
}
fmt.Println(desc)
}
TorrentFiles
returns []string
import (
"fmt"
"log"
"github.com/irevenko/go-nyaa/nyaa"
)
func main() {
files, err := nyaa.TorrentFiles("https://nyaa.si/view/1366002") // nyaa.si or sukebei.nyaa.si
if err != nil {
log.Fatal(err)
}
for _, v := range files {
fmt.Println(v)
}
}
- Pagination does not work with RSS
- Ascending sort does not work with RSS
git clone https://github.com/irevenko/go-nyaa.git
cd go-nyaa
go get -d ./...
go run _examples/nyaa_search.go
- RSS Feed, xml
- Parsing html in Go
(c) 2021 Ilya Revenko. MIT License