pixiv

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnmarshalPixivAjax = errors.New("error decoding artwork info, maybe the artwork is deleted")
)
View Source
var ReqClient *req.Client

Functions

func GetPid

func GetPid(url string) string

Types

type Item

type Item struct {
	XMLName     xml.Name `xml:"item"`
	Title       string   `xml:"title"`
	Description string   `xml:"description"`
	PubDate     string   `xml:"pubDate"`
	Guid        string   `xml:"guid"`
	Link        string   `xml:"link"`
	Author      string   `xml:"author"`
}

type Pixiv

type Pixiv struct{}

func (*Pixiv) Config

func (p *Pixiv) Config() *config.SourceCommonConfig

func (*Pixiv) FetchNewArtworks

func (p *Pixiv) FetchNewArtworks(limit int) ([]*types.Artwork, error)

func (*Pixiv) FetchNewArtworksWithCh

func (p *Pixiv) FetchNewArtworksWithCh(artworkCh chan *types.Artwork, limit int) error

func (*Pixiv) GetArtworkInfo

func (p *Pixiv) GetArtworkInfo(sourceURL string) (*types.Artwork, error)

func (*Pixiv) GetCommonSourceURL

func (p *Pixiv) GetCommonSourceURL(url string) string

func (*Pixiv) GetFileName

func (p *Pixiv) GetFileName(artwork *types.Artwork, picture *types.Picture) string

func (*Pixiv) GetPictureInfo

func (p *Pixiv) GetPictureInfo(sourceURL string, index uint) (*types.Picture, error)

func (*Pixiv) GetSourceURLRegexp

func (p *Pixiv) GetSourceURLRegexp() *regexp.Regexp

func (*Pixiv) Init

func (p *Pixiv) Init()

type PixivAjaxResp

type PixivAjaxResp struct {
	Err     bool               `json:"error"`
	Message string             `json:"message"`
	Body    *PixivAjaxRespBody `json:"body"`
}

func (*PixivAjaxResp) ToArtwork

func (resp *PixivAjaxResp) ToArtwork() (*types.Artwork, error)

type PixivAjaxRespBody

type PixivAjaxRespBody struct {
	IllustId   string `json:"illustId"`
	IlustTitle string `json:"illustTitle"`
	IllustType int    `json:"illustType"`
	Urls       struct {
		Mini     string `json:"mini"`
		Thumb    string `json:"thumb"`
		Small    string `json:"small"`
		Regular  string `json:"regular"`
		Original string `json:"original"`
	} `json:"urls"`
	Tags        PixivAjaxRespBodyTags `json:"tags"`
	UserId      string                `json:"userId"`
	Username    string                `json:"userName"`
	UserAccount string                `json:"userAccount"`
	Description string                `json:"description"`
}

type PixivAjaxRespBodyTagTranslation

type PixivAjaxRespBodyTagTranslation struct {
	En string `json:"en"`
}

type PixivAjaxRespBodyTags

type PixivAjaxRespBodyTags struct {
	Tags []PixivAjaxRespBodyTagsTag `json:"tags"`
}

type PixivAjaxRespBodyTagsTag

type PixivAjaxRespBodyTagsTag struct {
	// 返回里确实就是这么套的
	Tag         string                           `json:"tag"`
	Translation *PixivAjaxRespBodyTagTranslation `json:"translation"`
}

type PixivIllustPages

type PixivIllustPages struct {
	Err     bool                    `json:"error"`
	Message string                  `json:"message"`
	Body    []*PixivIllustPagesBody `json:"body"`
}

type PixivIllustPagesBody

type PixivIllustPagesBody struct {
	Urls struct {
		ThumbMini string `json:"thumb_mini"`
		Small     string `json:"small"`
		Regular   string `json:"regular"`
		Original  string `json:"original"`
	} `json:"urls"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

type PixivRss

type PixivRss struct {
	XMLName xml.Name `xml:"rss"`
	Channel channel  `xml:"channel"`
}

Jump to

Keyboard shortcuts

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