bilibili

package
v0.72.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: AGPL-3.0 Imports: 11 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 ErrInvalidArtwork = errors.New("invalid artwork")

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(_ types.Service)

type BilibiliDesktopDynamicApiAuthor added in v0.68.0

type BilibiliDesktopDynamicApiAuthor struct {
	User *struct {
		Mid  int    `json:"mid"`
		Name string `json:"name"`
	} `json:"user"`
}

type BilibiliDesktopDynamicApiDesc added in v0.68.0

type BilibiliDesktopDynamicApiDesc struct {
	RichTextNodes []*BilibiliDesktopDynamicApiRichTextNode `json:"rich_text_nodes"`
	Text          string                                   `json:"text"`
}

type BilibiliDesktopDynamicApiDrawItem added in v0.68.0

type BilibiliDesktopDynamicApiDrawItem struct {
	Height int      `json:"height"`
	Width  int      `json:"width"`
	Size   float64  `json:"size"`
	Src    string   `json:"src"`
	Tags   []string `json:"tags"`
}

type BilibiliDesktopDynamicApiDynamic added in v0.68.0

type BilibiliDesktopDynamicApiDynamic struct {
	DynDraw *struct {
		Id    int                                  `json:"id"`
		Items []*BilibiliDesktopDynamicApiDrawItem `json:"items"`
	} `json:"dyn_draw"`
	Type string `json:"type"`
}

type BilibiliDesktopDynamicApiEmoji added in v0.68.0

type BilibiliDesktopDynamicApiEmoji struct {
	IconUrl string `json:"icon_url"`
	Size    int    `json:"size"`
	Text    string `json:"text"`
	Type    int    `json:"type"`
}

type BilibiliDesktopDynamicApiItem added in v0.68.0

type BilibiliDesktopDynamicApiItem struct {
	IdStr   string                             `json:"id_str"`
	Type    string                             `json:"type"`
	Modules []*BilibiliDesktopDynamicApiModule `json:"modules"`
}

type BilibiliDesktopDynamicApiModule added in v0.68.0

type BilibiliDesktopDynamicApiModule struct {
	ModuleType    string                            `json:"module_type"`
	ModuleAuthor  *BilibiliDesktopDynamicApiAuthor  `json:"module_author,omitempty"`
	ModuleDesc    *BilibiliDesktopDynamicApiDesc    `json:"module_desc,omitempty"`
	ModuleDynamic *BilibiliDesktopDynamicApiDynamic `json:"module_dynamic,omitempty"`
}

type BilibiliDesktopDynamicApiResp added in v0.68.0

type BilibiliDesktopDynamicApiResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    *struct {
		Item *BilibiliDesktopDynamicApiItem `json:"item"`
	} `json:"data"`
}

func (*BilibiliDesktopDynamicApiResp) ToArtwork added in v0.68.0

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

type BilibiliDesktopDynamicApiRichTextNode added in v0.68.0

type BilibiliDesktopDynamicApiRichTextNode struct {
	Type     string                          `json:"type"`
	OrigText string                          `json:"orig_text"`
	Text     string                          `json:"text"`
	Emoji    *BilibiliDesktopDynamicApiEmoji `json:"emoji,omitempty"`
}

type BilibiliWebDynamicApiData added in v0.68.0

type BilibiliWebDynamicApiData struct {
	Item *BilibiliWebDynamicApiItem `json:"item"`
}

type BilibiliWebDynamicApiItem added in v0.68.0

type BilibiliWebDynamicApiItem struct {
	Modules *struct {
		ModuleAuthor  *BilibiliWebDynamicApiModuleAuthor  `json:"module_author"`
		ModuleDynamic *BilibiliWebDynamicApiModuleDynamic `json:"module_dynamic"`
	} `json:"modules"`
	Type  string `json:"type"`
	IdStr string `json:"id_str"`
}

type BilibiliWebDynamicApiModuleAuthor added in v0.68.0

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

type BilibiliWebDynamicApiModuleDynamic added in v0.68.0

type BilibiliWebDynamicApiModuleDynamic struct {
	Major *struct {
		Opus *struct {
			Pics    []*BilibiliWebDynamicApiPic   `json:"pics"`
			Summary *BilibiliWebDynamicApiSummary `json:"summary"`
			Title   string                        `json:"title"`
		} `json:"opus"`
		Type string `json:"type"`
	} `json:"major"`
}

type BilibiliWebDynamicApiPic added in v0.68.0

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

type BilibiliWebDynamicApiResp added in v0.68.0

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

func (*BilibiliWebDynamicApiResp) ToArtwork added in v0.68.0

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

type BilibiliWebDynamicApiSummary added in v0.68.0

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

Jump to

Keyboard shortcuts

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