Documentation ¶
Index ¶
Constants ¶
const ( // BaseUrl is the url base of site BaseUrl string = "https://nhentai.net" // DoujinBaseUrl is the prefix that comes before the id in the doujinshi url DoujinBaseUrl string = "https://nhentai.net/g/" // ImageBaseUrl is base url for the image link ImageBaseUrl string = "https://i.nhentai.net" // ThumbnailBaseUrl is the base url for the thumbnail link ThumbnailBaseUrl string = "https://t.nhentai.net" // DefaultPageNameTemplate is the default template for generate the image name in the Doujinshi.Save method DefaultPageNameTemplate string = "{{.Page.Num}}.{{.Page.Ext}}" // DefaultDoujinNameTemplate is the default template for generate the doujin name folder in the Doujinshi.Save method DefaultDoujinNameTemplate string = "{{.Doujinshi.Id}} - {{.Doujinshi.Title.Pretty}}" )
const ( // Recent order Recent = "" // PopularAllTime order PopularAllTime = "popular" // PopularThisWeek order PopularThisWeek = "popular-week" // PopularToday order PopularToday = "popular-today" )
Variables ¶
var ClientHttp *http.Client
ClientHttp is the client used for http requests. The default value is http.DefaultClient.
var ProgressBarTemplate string
ProgressBarTemplate is template for the progress bar
var UseProgressBar bool
UseProgressBar used for some methods. By default it is false and the progress bar not used, but it can be set to true and the progress bar will be used automatically where necessary.
Functions ¶
This section is empty.
Types ¶
type Avatar ¶
type Avatar struct {
// contains filtered or unexported fields
}
Avatar is a struct that contains all the information of a user avatar
func (*Avatar) GenerateName ¶
GenerateName is a function that generates the image name from the object data and assign it to the field object Name
func (*Avatar) GetData ¶
func (i *Avatar) GetData() error
GetData is a function that gets the data of image and assign it to the field object Data
type Comment ¶
type Comment struct { Id int `validate:"min=0"` GalleryId int `validate:"min=0"` Poster *User PostDate time.Time Body string }
Comment is a struct that contains all the information of a comment
func (*Comment) UnmarshalJSON ¶
UnmarshalJSON is a json parse for the comment object
type Cover ¶
type Cover struct {
// contains filtered or unexported fields
}
Cover is a struct that contains all the information of the doujinshi cover
func (*Cover) GenerateName ¶
GenerateName is a function that generates the image name from the object data and assign it to the field object Name
func (*Cover) GetData ¶
func (i *Cover) GetData() error
GetData is a function that gets the data of image and assign it to the field object Data
func (*Cover) GetSize ¶
func (i *Cover) GetSize() error
GetSize is a function that gets the size of the image and assign it to the object
type Doujinshi ¶
type Doujinshi struct { Id int Url string MediaId int Title *Title CoverImage *Cover Thumbnail *Thumbnail Pages []*Page Scanlator string UploadDate time.Time Parodies []*TagInfo Characters []*TagInfo Tags []*TagInfo Artists []*TagInfo Groups []*TagInfo Languages []*TagInfo Categories []*TagInfo NumPages int NumFavorites int Related []*Doujinshi Comments []*Comment // contains filtered or unexported fields }
Doujinshi is the data struct that describes a manga or a doujinshi
func NewDoujinshiId ¶
NewDoujinshiId is a constructor of the doujinshi object
func NewDoujinshiUrl ¶
NewDoujinshiUrl is a constructor of the doujinshi object
func RandomDoujin ¶ added in v0.5.3
RandomDoujin is a function that generate a random doujinshi
func (*Doujinshi) GetComments ¶
GetComments is a function that gets the related comments of doujinshi and assign them to the doujinshi object
func (*Doujinshi) GetRelated ¶
GetRelated is a function that gets the related doujinshi and assign it to the doujinshi object
func (*Doujinshi) GetUrl ¶
GetUrl is a function that gets the url of the doujinshi and assign them to the doujinshi object
func (*Doujinshi) Save ¶
Save is a function that download all pages of doujinshi in the specified directory. The name of image can be described by template.
func (*Doujinshi) UnmarshalJSON ¶
UnmarshalJSON is a json parser of doujinshi object
type Page ¶
type Page struct { Num int // contains filtered or unexported fields }
Page is a struct that contains all the information of a doujinshi page
func (*Page) GenerateName ¶
GenerateName is a function that generates the image name from the object data and assign it to the field object Name
func (*Page) GetData ¶
func (i *Page) GetData() error
GetData is a function that gets the data of image and assign it to the field object Data
func (*Page) GetSize ¶
func (i *Page) GetSize() error
GetSize is a function that gets the size of the image and assign it to the object
type QueryFilter ¶ added in v0.5.0
QueryFilter is a type for the result of a Query
type QueryOptions ¶
QueryOptions is a type for the option of a query
type QueryResult ¶
type QueryResult struct { Result []*Doujinshi `json:"result"` NumPages int `json:"num_pages"` PerPage int `json:"per_page"` }
QueryResult is a type for the result of a Query
func RecentDoujinshi ¶
func RecentDoujinshi(opts QueryOptions) (qr QueryResult, err error)
RecentDoujinshi is a function that returns the recent doujinshi
func Search ¶
func Search(query string, opt QueryOptions) (qr QueryResult, err error)
Search is a function that returns the doujinshi searched
func SearchCustom ¶ added in v0.5.0
func SearchCustom(query string, filters QueryFilter) (qr QueryResult, err error)
SearchCustom is a function that search doujinshi with query and filter them by tag.
func SearchTag ¶
func SearchTag(tagId int, opt QueryOptions) (qr QueryResult, err error)
SearchTag is a function that returns the doujinshi related to searched tags
type TagInfo ¶ added in v0.5.0
TagInfo is a struct that contains all the information related to the tags of a doujinshi
type TagsType ¶ added in v0.5.0
type TagsType string
TagsType is the data struct that describes the type of tag
const ( // Tag is the tag of doujinshi Tag TagsType = "tag" // Group is the group of doujinshi Group TagsType = "group" // Artist is the artist of doujinshi Artist TagsType = "artist" // Language is the language of doujinshi Language TagsType = "language" // Category is the category of doujinshi Category TagsType = "category" // Parody is the parody of doujinshi Parody TagsType = "parody" // Character is the character of doujinshi Character TagsType = "character" )
type Thumbnail ¶
type Thumbnail struct {
// contains filtered or unexported fields
}
Thumbnail is a struct that contains all the information of a thumbnail
func (*Thumbnail) GenerateName ¶
GenerateName is a function that generates the image name from the object data and assign it to the field object Name
func (*Thumbnail) GetData ¶
func (i *Thumbnail) GetData() error
GetData is a function that gets the data of image and assign it to the field object Data
func (*Thumbnail) GetSize ¶
func (i *Thumbnail) GetSize() error
GetSize is a function that gets the size of the image and assign it to the object