cheese

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package cheese contains validated parameters and stable response models for Bilibili PUGV/course endpoints.

Index

Constants

View Source
const (
	Quality480P = bangumi.Quality480P
	Quality4K   = bangumi.Quality4K
	FormatDASH  = bangumi.FormatDASH
	Format4K    = bangumi.Format4K
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Brief

type Brief struct {
	Content string       `json:"content"`
	Images  []BriefImage `json:"img"`
	Title   string       `json:"title"`
	Type    int32        `json:"type"`
}

type BriefImage

type BriefImage struct {
	AspectRatio float64 `json:"aspect_ratio"`
	URL         string  `json:"url"`
}

type Client

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

Client provides public PUGV/course operations.

func NewClient

func NewClient(client *core.Client) Client

NewClient binds the cheese module to a shared client.

func (Client) EpisodeDetail

func (c Client) EpisodeDetail(ctx context.Context, episodeID ids.EpisodeID) (Course, error)

EpisodeDetail gets the containing course-season detail by episode ID.

func (Client) EpisodeList

func (c Client) EpisodeList(ctx context.Context, params EpisodeListParams) (EpisodeList, error)

EpisodeList gets one page of episodes in a course season.

func (Client) PlayURL

func (c Client) PlayURL(ctx context.Context, params PlayURLParams) (PlayURL, error)

PlayURL gets a course episode's playback payload.

func (Client) SeasonDetail

func (c Client) SeasonDetail(ctx context.Context, seasonID ids.SeasonID) (Course, error)

SeasonDetail gets course-season detail by season ID.

type Course

type Course struct {
	Brief             Brief           `json:"brief"`
	Cover             string          `json:"cover"`
	EpisodePage       EpisodePage     `json:"episode_page"`
	EpisodeSort       int32           `json:"episode_sort"`
	Episodes          []Episode       `json:"episodes"`
	ReleaseBottomInfo string          `json:"release_bottom_info"`
	ReleaseInfo       string          `json:"release_info"`
	ReleaseInfo2      string          `json:"release_info2"`
	ReleaseStatus     string          `json:"release_status"`
	SeasonID          uint64          `json:"season_id"`
	ShareURL          string          `json:"share_url"`
	ShortLink         string          `json:"short_link"`
	Stat              CourseStat      `json:"stat"`
	Status            int32           `json:"status"`
	Subtitle          string          `json:"subtitle"`
	Title             string          `json:"title"`
	Uploader          Uploader        `json:"up_info"`
	UserStatus        UserStatus      `json:"user_status"`
	Coupon            json.RawMessage `json:"coupon"`
	FAQ               json.RawMessage `json:"faq"`
	Payment           json.RawMessage `json:"payment"`
	PurchaseNote      json.RawMessage `json:"purchase_note"`
	PurchaseProtocol  json.RawMessage `json:"purchase_protocol"`
}

type CourseStat

type CourseStat struct {
	Play            uint64 `json:"play"`
	PlayDescription string `json:"play_desc"`
}

type Episode

type Episode struct {
	AID            uint64 `json:"aid"`
	CID            uint64 `json:"cid"`
	Cover          string `json:"cover"`
	Duration       uint64 `json:"duration"`
	From           string `json:"from"`
	ID             uint64 `json:"id"`
	Index          uint32 `json:"index"`
	Page           uint32 `json:"page"`
	Play           uint64 `json:"play"`
	Playable       bool   `json:"playable"`
	ReleaseDate    uint64 `json:"release_date"`
	Status         int32  `json:"status"`
	Subtitle       string `json:"subtitle"`
	Title          string `json:"title"`
	Watched        bool   `json:"watched"`
	WatchedHistory uint64 `json:"watchedHistory"`
}

type EpisodeList

type EpisodeList struct {
	Items []Episode   `json:"items"`
	Page  EpisodePage `json:"page"`
}

type EpisodeListParams

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

func NewEpisodeListParams

func NewEpisodeListParams(seasonID ids.SeasonID) EpisodeListParams

func (EpisodeListParams) EncodeQuery

func (p EpisodeListParams) EncodeQuery() (url.Values, error)

func (EpisodeListParams) WithPage

func (p EpisodeListParams) WithPage(page uint32) (EpisodeListParams, error)

func (EpisodeListParams) WithPageSize

func (p EpisodeListParams) WithPageSize(size uint32) (EpisodeListParams, error)

type EpisodePage

type EpisodePage struct {
	Next  bool   `json:"next"`
	Page  uint32 `json:"num"`
	Size  uint32 `json:"size"`
	Total uint32 `json:"total"`
}

type FormatFlags

type FormatFlags = bangumi.FormatFlags

type FragmentInfo

type FragmentInfo struct {
	Type     string `json:"fragment_type"`
	Index    int64  `json:"index"`
	AID      int64  `json:"aid"`
	Position string `json:"fragment_position"`
	CID      int64  `json:"cid"`
}

type FragmentVideo

type FragmentVideo struct {
	Info           FragmentInfo `json:"fragment_info"`
	PlayableStatus bool         `json:"playable_status"`
	VideoInfo      VideoInfo    `json:"video_info"`
}

type PlayURL

type PlayURL struct {
	From               string                `json:"from"`
	Result             string                `json:"result"`
	Message            string                `json:"message"`
	Quality            uint64                `json:"quality"`
	Format             string                `json:"format"`
	TimeLength         uint64                `json:"timelength"`
	AcceptFormat       string                `json:"accept_format"`
	AcceptDescriptions []string              `json:"accept_description"`
	AcceptQualities    []uint64              `json:"accept_quality"`
	VideoCodecID       uint8                 `json:"video_codecid"`
	SeekParameter      string                `json:"seek_param"`
	SeekType           string                `json:"seek_type"`
	DURLs              []video.DURL          `json:"durls"`
	DASH               *video.DASH           `json:"dash"`
	SupportFormats     []video.SupportFormat `json:"support_formats"`
	Code               int32                 `json:"code"`
	FormatFlags        uint64                `json:"fnval"`
	FormatVersion      uint64                `json:"fnver"`
	VideoProject       bool                  `json:"video_project"`
	Type               string                `json:"type"`
	HasPaid            bool                  `json:"has_paid"`
	IsPreview          *uint32               `json:"is_preview"`
	NoRecode           int32                 `json:"no_rexcode"`
	Status             int32                 `json:"status"`
	Fragments          []FragmentVideo       `json:"fragment_videos"`
	Volume             *Volume               `json:"volume"`
}

type PlayURLParams

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

func NewPlayURLParams

func NewPlayURLParams(aid ids.AID, episodeID ids.EpisodeID, cid ids.CID) PlayURLParams

func (PlayURLParams) EncodeQuery

func (p PlayURLParams) EncodeQuery() (url.Values, error)

func (PlayURLParams) WithFormatFlags

func (p PlayURLParams) WithFormatFlags(flags FormatFlags) PlayURLParams

func (PlayURLParams) WithQuality

func (p PlayURLParams) WithQuality(quality VideoQuality) PlayURLParams

type Progress

type Progress struct {
	LastEpisodeID    uint64 `json:"last_ep_id"`
	LastEpisodeIndex string `json:"last_ep_index"`
	LastTime         uint64 `json:"last_time"`
}

type Uploader

type Uploader struct {
	Avatar   string `json:"avatar"`
	Brief    string `json:"brief"`
	Follower uint64 `json:"follower"`
	IsFollow int32  `json:"is_follow"`
	Link     string `json:"link"`
	MID      uint64 `json:"mid"`
	UserName string `json:"uname"`
}

type UserStatus

type UserStatus struct {
	Favored      int32     `json:"favored"`
	FavoredCount uint64    `json:"favored_count"`
	Paid         int32     `json:"payed"`
	Progress     *Progress `json:"progress"`
}

type VideoInfo

type VideoInfo struct {
	NoRecode      int64           `json:"no_rexcode"`
	FormatFlags   int64           `json:"fnval"`
	VideoProject  bool            `json:"video_project"`
	ExpireTime    int64           `json:"expire_time"`
	FormatVersion int64           `json:"fnver"`
	Type          string          `json:"type"`
	URL           string          `json:"url"`
	Quality       int64           `json:"quality"`
	TimeLength    int64           `json:"timelength"`
	DASH          video.DASH      `json:"dash"`
	VideoCodecID  int64           `json:"video_codecid"`
	CID           int64           `json:"cid"`
	FileInfo      json.RawMessage `json:"file_info"`
}

type VideoQuality

type VideoQuality = bangumi.VideoQuality

type Volume

type Volume struct {
	MeasuredI         float64         `json:"measured_i"`
	TargetI           float64         `json:"target_i"`
	TargetOffset      float64         `json:"target_offset"`
	MeasuredLRA       float64         `json:"measured_lra"`
	TargetTP          float64         `json:"target_tp"`
	MeasuredTP        float64         `json:"measured_tp"`
	MeasuredThreshold float64         `json:"measured_threshold"`
	MultiSceneArgs    json.RawMessage `json:"multi_scene_args"`
}

Jump to

Keyboard shortcuts

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