getmoe: Index | Examples | Files | Directories

package getmoe

import ""

Package getmoe provides a REST client for image boards, such as Moebooru, Gelbooru and Danbooru. The goal of the project is to provide APIs for the most well-known image boards (boorus).



Package Files

board.go configuration.go doc.go post.go provider.go rating.go tags.go urlstring.go

func RegisterProvider Uses

func RegisterProvider(name string, provider Provider)

RegisterProvider registers booru provider

type AuthConfiguration Uses

type AuthConfiguration struct {
    Login          string `yaml:"login"`
    Password       string `yaml:"password"`
    HashedPassword string `yaml:"hashed_password"`
    APIKey         string `yaml:"api_key"`

AuthConfiguration provides configuration for authenticating

type Board Uses

type Board struct {
    Provider Provider
    // contains filtered or unexported fields

Board holds data for API access

func NewBoard Uses

func NewBoard(providerName string, config BoardConfiguration) (*Board, error)

NewBoard creates a new board with provided configuration

func NewBoardWithProvider Uses

func NewBoardWithProvider(provider Provider) *Board

NewBoardWithProvider creates a new board with provided configuration

func (*Board) Request Uses

func (b *Board) Request() ([]Post, error)

Request gets images by tags

func (*Board) RequestAll Uses

func (b *Board) RequestAll() ([]Post, error)

RequestAll checks all pages

type BoardConfiguration Uses

type BoardConfiguration struct {
    Provider ProviderConfiguration `yaml:",inline"`

BoardConfiguration holds board related configuration

type DownloadConfiguration Uses

type DownloadConfiguration struct {
    Request RequestConfiguration `yaml:",inline"`

DownloadConfiguration holds download related configuration

type GlobalConfiguration Uses

type GlobalConfiguration struct {
    Boards   map[string]BoardConfiguration `yaml:"boards"`
    Download DownloadConfiguration         `yaml:"download"`

GlobalConfiguration provides global configuration

func Load Uses

func Load(filename string) (*GlobalConfiguration, error)

Load loads global configuration

type Post Uses

type Post struct {
    ID        int       `json:"id"`
    FileURL   string    `json:"file_url"`
    FileSize  int       `json:"file_size"`
    Width     int       `json:"width"`
    Height    int       `json:"height"`
    CreatedAt time.Time `json:"created_at"`
    Tags      []string  `json:"tags"`
    Author    string    `json:"author"`
    Source    string    `json:"source"`
    Rating    string    `json:"rating"`
    Hash      string    `json:"hash"`
    Score     int       `json:"score"`

Post contains post data, represents intersection of *boorus post structs

func (*Post) HasTag Uses

func (p *Post) HasTag(tag string) bool

HasTag returns true if post has specified tag

func (*Post) Save Uses

func (p *Post) Save(saveDir string) error

Save post to dir

type Provider Uses

type Provider interface {
    PageRequest() (*http.Request, error)
    Parse([]byte) ([]Post, error)

Provider describes Board provider

func NewProvider Uses

func NewProvider(providerName string, conf ProviderConfiguration) (*Provider, error)

NewProvider creates a new provider

type ProviderConfiguration Uses

type ProviderConfiguration struct {
    Name         string            `yaml:"provider"`
    URL          URLString         `yaml:"url"`
    Auth         AuthConfiguration `yaml:",inline"`
    PasswordSalt string            `yaml:"password_salt"`
    AppkeySalt   string            `yaml:"appkey_salt"`
    PostsLimit   int               `yaml:"posts_limit"`

ProviderConfiguration holds provider related configuration

type Rating Uses

type Rating string

Rating defines boorus rating system

const (
    RatingSafe         Rating = "s"
    RatingQuestionable Rating = "q"
    RatingExplicit     Rating = "e"

Boorus rating system has safe, questionable and explicit tags.

type RequestConfiguration Uses

type RequestConfiguration struct {
    Tags Tags `yaml:"tags"`

RequestConfiguration holds request related configuration

type Tags Uses

type Tags []string

Tags provides fluent-style builder for boorus tags.


t := getmoe.NewTags("first_tag", "second_tag")
t.WithoutRating(getmoe.RatingQuestionable, getmoe.RatingExplicit)



first_tag second_tag and_this_tag -except_this_tag -rating:q -rating:e

func NewTags Uses

func NewTags(tags ...string) *Tags

NewTags allocates a new list. You may provide as many tags as you want.

t := getmoe.NewTags("tag1", "tag2")

func (*Tags) AfterDate Uses

func (t *Tags) AfterDate(date time.Time) *Tags

AfterDate appends date tag with after prefix.

func (*Tags) And Uses

func (t *Tags) And(tags ...string) *Tags

And appends tags to tag list.

t.And("tag3", "tag4")

func (*Tags) AtDate Uses

func (t *Tags) AtDate(date time.Time) *Tags

AtDate appends date tag.

func (*Tags) BeforeDate Uses

func (t *Tags) BeforeDate(date time.Time) *Tags

BeforeDate appends date tag with before prefix.

func (*Tags) No Uses

func (t *Tags) No(tags ...string) *Tags

No appends tags with 'no' prefix to tag list.

func (*Tags) Or Uses

func (t *Tags) Or(tags ...string) *Tags

Or appends tags with 'or' prefix to tag list. t.Or("tag5", "tag6")

func (Tags) String Uses

func (t Tags) String() string

func (*Tags) WithRating Uses

func (t *Tags) WithRating(r ...Rating) *Tags

WithRating appends rating tags.

func (*Tags) WithoutRating Uses

func (t *Tags) WithoutRating(r ...Rating) *Tags

WithoutRating appends rating tags with 'no' prefix.

type URLString Uses

type URLString struct {

URLString provides a helper to parse string as url.URL

func (*URLString) UnmarshalYAML Uses

func (f *URLString) UnmarshalYAML(unmashal func(interface{}) error) error

UnmarshalYAML implements unmarshaller interface for YAML


provider/danbooruPackage danbooru implements a simple library for accessing Danbooru-based image boards.
provider/gelbooruPackage gelbooru implements a simple library for accessing Gelbooru-based image boards.
provider/moebooruPackage moebooru implements a simple library for accessing Moebooru-based image boards.
provider/sankakuPackage sankaku implements a simple library for accessing Sankakucomplex-based image boards.

Package getmoe imports 12 packages (graph) and is imported by 5 packages. Updated 2019-03-12. Refresh now. Tools for package owners.