Documentation ¶
Overview ¶
Package nhentai provides Go bindings for nhentai.net's API.
Index ¶
- Variables
- type Client
- type Gallery
- func (gallery *Gallery) GetRelated() ([]*Gallery, error)
- func (gallery *Gallery) HasArtist(name string) bool
- func (gallery *Gallery) HasCategory(name string) bool
- func (gallery *Gallery) HasCharacter(name string) bool
- func (gallery *Gallery) HasGroup(name string) bool
- func (gallery *Gallery) HasLanguage(name string) bool
- func (gallery *Gallery) HasParody(name string) bool
- func (gallery *Gallery) HasTag(name string) bool
- func (gallery *Gallery) URL() string
- type Image
- type Query
- type Response
- type Tag
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // EndpointNH is the main endpoint of nhentai.net. EndpointNH = "https://nhentai.net" // EndpointGallery is the main endpoint where galleries are located. EndpointGallery = EndpointNH + "/g" // EndpointAPI is nhentai's API endpoint. EndpointAPI = EndpointNH + "/api" // EndpointAPIGallery is nhentai's API endpoint for individual galleries. EndpointAPIGallery = EndpointAPI + "/gallery" // EndpointAPIGalleries is nhentai's API endpoint for multiple galleries. This // is primarily used for the search API, which has not been implemented in // this package as of yet. EndpointAPIGalleries = EndpointAPI + "/galleries" // EndpointAPISearch is nhentai's search API endpoint. EndpointAPISearch = EndpointAPIGalleries + "/search" // EndpointAPITagged is nhentai's endpoint for multiple galleries with // specified tags. EndpointAPITagged = EndpointAPIGalleries + "/tagged" // EndpointAPIAll is nhentai's endpoint for muliple galleries. Honestly I'm // not sure what this even does, I'll remove it later if it turns out I don't // need it. EndpointAPIAll = EndpointAPIGalleries + "/all" // EndpointThumbs is the main endpoint of t.nhentai.net, which is primarily // used to store thumbnails and covers of doujins. EndpointThumbs = "https://t.nhentai.net" // EndpointThumbsGalleries is nhentai's API endpoint for gallery thumbnails // and covers. EndpointThumbsGalleries = EndpointThumbs + "/galleries" // EndpointImages is the main endpoint of i.nhentai.net, which is primarily // used to store the pages of doujins. EndpointImages = "https://i.nhentai.net" // EndpointImageGalleries is nhentai's API endpoint for gallery images, such // as pages. EndpointImagesGalleries = EndpointImages + "/galleries" )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GalleryFromID ¶
GalleryFromID takes an ID for a gallery and requests the nhentai API for information about that gallery, then makes and returns a pointer to a struct. If any error occurs, it returns a blank struct and the error.
type Gallery ¶
type Gallery struct { ID int `json:"id"` MediaID string `json:"media_id"` Characters []*Tag Parodies []*Tag Tags []*Tag Artists []*Tag Groups []*Tag Languages []*Tag Categories []*Tag PagesCount int `json:"num_pages"` FavouritesCount int `json:"favourites"` Timestamp Timestamp `json:"upload_date"` Title struct { Japanese string `json:"japanese"` Pretty string `json:"pretty"` English string `json:"english"` } `json:"title"` Images struct { Cover *Image `json:"cover"` Thumbnail *Image `json:"thumbnail"` Pages []*Image `json:"pages"` } `json:"images"` Scanlator string `json:"scanlator"` AllTags []*Tag `json:"tags"` }
Gallery represents an nhentai gallery.
func (*Gallery) GetRelated ¶
func (*Gallery) HasCategory ¶
func (*Gallery) HasCharacter ¶
func (*Gallery) HasLanguage ¶
type Image ¶
type Image struct { Width int `json:"w"` Height int `json:"h"` Type string `json:"t"` URL string Ext string }
Image represents a gallery image.
type Query ¶
type Query struct { Terms []string `json:"terms"` Page int `json:"page"` SortPopular bool `json:"sort_popular"` }
Query is a search query used by search functions.
type Response ¶
type Response struct { Result []*Gallery `json:"result"` PerPage int `json:"per_page"` NumPages int `json:"num_pages"` }
Response is the response from a search query.
Click to show internal directories.
Click to hide internal directories.