kemono

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidKemonoPostURL = errors.New("invalid kemono post url")
	ErrNotPicture           = errors.New("kemono post files or attachments are not pictures")
)

Functions

func Init

func Init()

Types

type Kemono

type Kemono struct {
	// contains filtered or unexported fields
}

func (*Kemono) FetchNewArtworks

func (k *Kemono) FetchNewArtworks(ctx context.Context, limit int) ([]*dto.FetchedArtwork, error)

func (*Kemono) GetArtworkInfo

func (k *Kemono) GetArtworkInfo(ctx context.Context, sourceURL string) (*dto.FetchedArtwork, error)

func (*Kemono) MatchesSourceURL

func (k *Kemono) MatchesSourceURL(text string) (string, bool)

func (*Kemono) PrettyFileName

func (k *Kemono) PrettyFileName(artwork shared.ArtworkLike, picture shared.PictureLike) string

PrettyFileName implements source.ArtworkSource.

type KemonoCreatorProfileResp

type KemonoCreatorProfileResp struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Service  string `json:"service"`
	PubilcID string `json:"public_id"` // username
}

type KemonoPostAttachment

type KemonoPostAttachment struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

type KemonoPostResp

type KemonoPostResp struct {
	Post struct {
		ID      string `json:"id"`
		User    string `json:"user"`
		Service string `json:"service"`
		Title   string `json:"title"`
		Content string `json:"content"`
		File    struct {
			Name string `json:"name"`
			Path string `json:"path"`
		} `json:"file"` // 封面?
		Tags        []string               `json:"tags"`
		Attachments []KemonoPostAttachment `json:"attachments"`
	} `json:"post"`
	Previews []KemonoPreview `json:"previews"`
}

type KemonoPreview

type KemonoPreview struct {
	Type   string `json:"type"`   // "thumbnail" or others?
	Server string `json:"server"` // cdn server, e.g. "https://n4.kemono.cr"
	Name   string `json:"name"`   // file name, 好像没啥用
	Path   string `json:"path"`   // file path, 和原图一致
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL