Yakiyo / nekos_best.go

Go module for nekos.best

Home Page:https://pkg.go.dev/github.com/Yakiyo/nekos_best.go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nekos_best.go

Go Reference ci

Go module for nekos.best

Getting started

Add the module to your project

$ go get -u github.com/Yakiyo/nekos_best.go

Usage

Import it in your code

import (
    nb github.com/Yakiyo/nekos_best.go
)

Full reference: https://pkg.go.dev/github.com/Yakiyo/nekos_best.go

Fetch a single entry

res, err := nb.Fetch("neko")
if err != nil {
    // handle err
}
fmt.Println(res.Url, res.Artist_name, res.Artist_href)

Fetch multiple entries

res, _ := nb.FetchMany("baka", 3)

fmt.Println(res[0].Url)

Fetch a file

import "os"

res, _ := nb.FetchFile("pat")

os.WriteFile("image.png", res.Data, 0644)

// print associated entry for the image
fmt.Println(res.Body)

Search for an entry

res, _ := nb.Search("Gochuumon wa Usagi Desuka??", "baka", 3)

fmt.Println(res)

Generate random category

cat := nb.RandomCategory()

Author

nekos_best.go © Yakiyo. Authored and maintained by Yakiyo.

Released under MIT License

About

Go module for nekos.best

https://pkg.go.dev/github.com/Yakiyo/nekos_best.go

License:MIT License


Languages

Language:Go 100.0%