Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tdakkota/gnhentai
nhentai.net API Client
https://github.com/tdakkota/gnhentai
anime doujinshi hentai hentai-downloader nhentai nhentai-api nhentai-client nhentai-parser
Last synced: about 2 months ago
JSON representation
nhentai.net API Client
- Host: GitHub
- URL: https://github.com/tdakkota/gnhentai
- Owner: tdakkota
- License: mit
- Created: 2020-03-17T14:44:20.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-19T02:57:26.000Z (over 1 year ago)
- Last Synced: 2024-10-18T21:17:16.368Z (2 months ago)
- Topics: anime, doujinshi, hentai, hentai-downloader, nhentai, nhentai-api, nhentai-client, nhentai-parser
- Language: Go
- Homepage:
- Size: 140 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gnhentai
gnhentai — nhentai.net parser for Go.
---
## Getting Started
This library is packaged using [Go modules][go-modules]. You can get it via:
```
go get github.com/tdakkota/gnhentai
```## Use as lib
There are two implementations of `gnhentai.Client`:
- `api.Client` which uses NHentai API
- `parser.Parser` which parses NHentai web pages using `goquery`I recommend you to use API version, it is more stable.
[Example](https://github.com/tdakkota/gnhentai/tree/master/examples/download-random-cover/main.go)
```go
package mainimport (
"fmt"
"github.com/tdakkota/gnhentai"
"github.com/tdakkota/gnhentai/api"
"io"
"os"
)func main() {
c := api.NewClient()doujinshi, err := c.Random()
if err != nil {
panic(err)
}fmt.Println("Downloading", doujinshi.Name())
fmt.Println("Tags:")
for _, tag := range doujinshi.Tags {
fmt.Println(" - ", tag.Name)
}format := gnhentai.FormatFromImage(doujinshi.Images.Cover)
cover, err := c.Cover(doujinshi.MediaID, format)
if err != nil {
panic(err)
}f, err := os.Create(fmt.Sprintf("cover_%d.%s", doujinshi.MediaID, format))
if err != nil {
panic(err)
}_, err = io.Copy(f, cover)
if err != nil {
panic(err)
}
}```
## gnhentai-cli
Install and run (`GOBIN` should be in `PATH`), it will download random book into current dir```
gnhentai-cli download
```or
```
gnhentai-cli download --id=
```## Use API server
```
gnhentai-server run --bind=
```## Related
- [Swagger file](https://gist.github.com/tdakkota/6efa100de2000549027617b1a1088d78)
- [Unofficial API Docs](https://edgyboi2414.github.io/nhentai-api)[go-modules]: https://github.com/golang/go/wiki/Modules