Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/irevenko/go-nyaa
🐈📦 nyaa.si client library for Go
https://github.com/irevenko/go-nyaa
client client-library go go-client golang nyaa nyaa-api nyaa-rss nyaa-se nyaa-si nyaasi
Last synced: 3 months ago
JSON representation
🐈📦 nyaa.si client library for Go
- Host: GitHub
- URL: https://github.com/irevenko/go-nyaa
- Owner: irevenko
- License: mit
- Created: 2021-03-31T12:03:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-26T21:11:09.000Z (over 1 year ago)
- Last Synced: 2024-06-19T02:01:14.812Z (5 months ago)
- Topics: client, client-library, go, go-client, golang, nyaa, nyaa-api, nyaa-rss, nyaa-se, nyaa-si, nyaasi
- Language: Go
- Homepage: https://nyaa.si
- Size: 40 KB
- Stars: 32
- Watchers: 4
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🐈📦 go-nyaa
[![Go Reference](https://pkg.go.dev/badge/github.com/irevenko/go-nyaa.svg)](https://pkg.go.dev/github.com/irevenko/go-nyaa)
[![Go Report Card](https://goreportcard.com/badge/github.com/irevenko/go-nyaa)](https://goreportcard.com/report/github.com/irevenko/go-nyaa)> nyaa.si client library for Go
Built on top of:
gofeed - search using RSS
colly - scrap torrent details page
Original idea:
ejnshtein/nyaa-api# Installation 🔨
```go get github.com/mmcdole/gofeed```
```go get github.com/gocolly/colly```
```go get -u github.com/irevenko/go-nyaa```# Contributing 🤝
Contributions, issues and feature requests are welcome! 👍
Feel free to check [open issues](https://github.com/irevenko/go-nyaa/issues).# Docs 📒
Go reference,
Examples
* [Search Example](#search-example "Goto #search-example-")
* [Search Options](#search-options "Goto #search-options-")
* [Provider](#provider "Goto #provider-")
* [Query](#query "Goto #query-")
* [Category](#category "Goto #category-")
* [nyaa](#nyaa "Goto #nyaa-")
* [sukebei](#sukebei "Goto #sukebei-")
* [SortBy](#sortby "Goto #sortby-")
* [Filter](#filter "Goto #filter-")
* [TorrentComments](#torrentcomments "Goto #torrentcomments-")
* [TorrentDescription](#torrentdescription "Goto #torrentdescription-")
* [TorrentFiles](#torrentfiles "Goto #torrentfiles-")## Search Example
```Search``` returns ```[]Torrent``````go
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)
}
```## Search Options
```go
type SearchOptions struct {
Provider string
Query string
Category string
SortBy string
Filter string
}
```## Provider
- ```nyaa``` - nyaa.si
- ```sukebei``` - sukebei.nyaa.si## Query
- your desired search string## Category
### nyaa
* ```all``` - All Categories
* ```anime``` - All Anime
* ```anime-amv```
* ```anime-eng```
* ```anime-non-eng```
* ```anime-raw```
* ```audio``` - All Audio
* ```audio-lossless```
* ```audio-lossy```
* ```literature``` - All Literature
* ```literature-eng```
* ```literature-non-eng```
* ```literature-raw```
* ```live-action``` - All Live Action
* ```live-action-idol-prom```
* ```live-action-eng```
* ```live-action-non-eng```
* ```live-action-raw```
* ```pictures``` - All Pictures
* ```pictures-graphics```
* ```pictures-photos```
* ```software``` - All Software
* ```software-apps```
* ```software-games```### sukebei
* ```all``` - All Categories
* ```art``` - All Art
* ```art-anime```
* ```art-doujinshi```
* ```art-manga```
* ```art-games```
* ```art-pictures```
* ```real-life``` - All Real Life
* ```real-life-photos```
* ```real-life-videos```## SortBy
- ```comments```
- ```downloads```
- ```date```
- ```seeders```
- ```leechers```
- ```size```## Filter
- ```no-filter```
- ```no-remakes```
- ```trusted-only```## TorrentComments
```TorrentComments``` returns ```[]Comment``````go
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
```TorrentDescription``` returns ```string``````go
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
```TorrentFiles``` returns ```[]string``````go
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)
}
}
```# Notes
- Pagination does not work with RSS
- Ascending sort does not work with RSS# Quick Start 🚀
```git clone https://github.com/irevenko/go-nyaa.git```
```cd go-nyaa```
```go get -d ./...```
```go run _examples/nyaa_search.go```# What I Learned 🧠
- RSS Feed, xml
- Parsing html in Go# License 📑
(c) 2021 Ilya Revenko. [MIT License](https://tldrlegal.com/license/mit-license)