Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🐈📦 nyaa.si client library for Go

License

NotificationsYou must be signed in to change notification settings

irevenko/go-nyaa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go ReferenceGo Report Card

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 checkopen issues.

Docs 📒

Go reference,Examples

Search Example

Search returns[]Torrent

import ("fmt""log""github.com/irevenko/go-nyaa/nyaa")funcmain() {opt:= nyaa.SearchOptions{Provider:"nyaa",// Provider is the only required optionQuery:"LN",Category:"literature",SortBy:"seeders",Filter:"trusted-only",    }torrents,err:=nyaa.Search(opt)iferr!=nil {log.Fatal(err)    }fmt.Println(torrents)}

Search Options

typeSearchOptionsstruct {ProviderstringQuerystringCategorystringSortBystringFilterstring}

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

import ("fmt""log""github.com/irevenko/go-nyaa/nyaa")funcmain() {comms,err:=nyaa.TorrentComments("https://nyaa.si/view/1366002")// nyaa.si or sukebei.nyaa.siiferr!=nil {log.Fatal(err)}for_,v:=rangecomms {fmt.Println("user: "+v.User)fmt.Println("at: "+v.Date)fmt.Println("text: "+v.Text)fmt.Println()}}

TorrentDescription

TorrentDescription returnsstring

import ("fmt""log""github.com/irevenko/go-nyaa/nyaa")funcmain() {desc,err:=nyaa.TorrentDescription("https://nyaa.si/view/1366002")// nyaa.si or sukebei.nyaa.siiferr!=nil {log.Fatal(err)}fmt.Println(desc)}

TorrentFiles

TorrentFiles returns[]string

import ("fmt""log""github.com/irevenko/go-nyaa/nyaa")funcmain() {files,err:=nyaa.TorrentFiles("https://nyaa.si/view/1366002")// nyaa.si or sukebei.nyaa.siiferr!=nil {log.Fatal(err)}for_,v:=rangefiles {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


[8]ページ先頭

©2009-2025 Movatter.jp