bilibili

package
v0.38.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequestFailed = errors.New("request bilibili dynamic url failed")
	ErrIndexOOB      = errors.New("index out of artwork pictures bounds")
	ErrInvalidURL    = errors.New("invalid bilibili dynamic url")
)
View Source
var ReqClient *req.Client

Functions

This section is empty.

Types

type Bilibili

type Bilibili struct{}

func (*Bilibili) Config

func (b *Bilibili) Config() *config.SourceCommonConfig

func (*Bilibili) FetchNewArtworks

func (b *Bilibili) FetchNewArtworks(limit int) ([]*types.Artwork, error)

func (*Bilibili) FetchNewArtworksWithCh

func (b *Bilibili) FetchNewArtworksWithCh(artworkCh chan *types.Artwork, limit int) error

func (*Bilibili) GetArtworkInfo

func (b *Bilibili) GetArtworkInfo(sourceURL string) (*types.Artwork, error)

func (*Bilibili) GetCommonSourceURL

func (b *Bilibili) GetCommonSourceURL(url string) string

func (*Bilibili) GetFileName

func (b *Bilibili) GetFileName(artwork *types.Artwork, picture *types.Picture) string

func (*Bilibili) GetPictureInfo

func (b *Bilibili) GetPictureInfo(sourceURL string, index uint) (*types.Picture, error)

func (*Bilibili) GetSourceURLRegexp

func (b *Bilibili) GetSourceURLRegexp() *regexp.Regexp

func (*Bilibili) Init

func (b *Bilibili) Init()

type BilibiliApiData

type BilibiliApiData struct {
	Item *BilibiliApiItem `json:"item"`
}

type BilibiliApiItem

type BilibiliApiItem struct {
	Modules *struct {
		ModuleAuthor  *BilibiliApiModuleAuthor  `json:"module_author"`
		ModuleDynamic *BilibiliApiModuleDynamic `json:"module_dynamic"`
	} `json:"modules"`
	Type  string `json:"type"`
	IdStr string `json:"id_str"`
}

type BilibiliApiModuleAuthor

type BilibiliApiModuleAuthor struct {
	Name string `json:"name"`
	Mid  int    `json:"mid"`
}

type BilibiliApiModuleDynamic

type BilibiliApiModuleDynamic struct {
	Major *struct {
		Opus *struct {
			Pics    []*BilibiliApiPic   `json:"pics"`
			Summary *BilibiliApiSummary `json:"summary"`
			Title   string              `json:"title"`
		} `json:"opus"`
		Type string `json:"type"`
	} `json:"major"`
}

type BilibiliApiPic

type BilibiliApiPic struct {
	Height int     `json:"height"`
	Width  int     `json:"width"`
	Size   float64 `json:"size"`
	Url    string  `json:"url"`
}

type BilibiliApiResp

type BilibiliApiResp struct {
	Code    int              `json:"code"`
	Message string           `json:"message"`
	TTL     int              `json:"ttl"`
	Data    *BilibiliApiData `json:"data"`
}

func (*BilibiliApiResp) ToArtwork

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

type BilibiliApiSummary

type BilibiliApiSummary struct {
	Text string `json:"text"`
}

Jump to

Keyboard shortcuts

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