pixiv-scrapper/gelbooru/types.go

48 lines
1.1 KiB
Go

package gelbooru
import "strings"
type Post struct {
Change int `json:"change"`
CreatedAt string `json:"created_at"`
Directory string `json:"directory"`
FileURL string `json:"file_url"`
Hash string `json:"hash"`
Height int `json:"height"`
Width int `json:"width"`
ID int `json:"id"`
Image string `json:"image"`
Owner string `json:"owner"`
ParentID string `json:"parent_id"`
PreviewHeight int `json:"preview_height"`
PreviewWidth int `json:"preview_width"`
Rating string `json:"raiting"`
Sample int `json:"sample"`
SampleHeight int `json:"sample_height"`
SampleWidth int `json:"sample_width"`
Score int `json:"score"`
Source string `json:"source"`
TagsOriginal string `json:"tags"`
Title string `json:"title"`
}
func (p *Post) Name() string {
return p.Title
}
func (p *Post) Author() string {
return ""
}
func (p *Post) Comment() string {
return ""
}
func (p *Post) Tags() []string {
return strings.Split(p.TagsOriginal, " ")
}
func (p *Post) Files() []string {
return []string{p.FileURL}
}