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-amvanime-enganime-non-enganime-raw
audio- All Audioaudio-losslessaudio-lossy
literature- All Literatureliterature-engliterature-non-engliterature-raw
live-action- All Live Actionlive-action-idol-promlive-action-englive-action-non-englive-action-raw
pictures- All Picturespictures-graphicspictures-photos
software- All Softwaresoftware-appssoftware-games
all- All Categoriesart- All Artart-animeart-doujinshiart-mangaart-gamesart-pictures
real-life- All Real Lifereal-life-photosreal-life-videos
commentsdownloadsdateseedersleecherssize
no-filterno-remakestrusted-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