article

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: 9 Imported by: 0

Documentation

Overview

Package article contains validated parameters and stable response models for Bilibili article endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArticleCard

type ArticleCard struct {
	ActID            int64            `json:"act_id"`
	ApplyTime        string           `json:"apply_time"`
	Attributes       *int32           `json:"attributes"`
	AuthenMark       *json.RawMessage `json:"authenMark"`
	Author           Author           `json:"author"`
	BannerURL        string           `json:"banner_url"`
	Categories       []Category       `json:"categories"`
	Category         Category         `json:"category"`
	CheckState       int32            `json:"check_state"`
	CheckTime        string           `json:"check_time"`
	ContentPictures  *json.RawMessage `json:"content_pic_list"`
	CoverAID         int64            `json:"cover_avid"`
	CreatedAt        int64            `json:"ctime"`
	Dispute          *json.RawMessage `json:"dispute"`
	Dynamic          *string          `json:"dynamic"`
	ID               ids.CVID         `json:"id"`
	ImageURLs        []string         `json:"image_urls"`
	IsLike           bool             `json:"is_like"`
	List             *Collection      `json:"list"`
	Media            Media            `json:"media"`
	ModifiedAt       int64            `json:"mtime"`
	OriginImageURLs  []string         `json:"origin_image_urls"`
	OriginTemplateID int32            `json:"origin_template_id"`
	Original         int32            `json:"original"`
	PrivatePublish   int32            `json:"private_pub"`
	PublishTime      int64            `json:"publish_time"`
	Reprint          int32            `json:"reprint"`
	State            int32            `json:"state"`
	Stats            Stats            `json:"stats"`
	Summary          string           `json:"summary"`
	TemplateID       int32            `json:"template_id"`
	Title            string           `json:"title"`
	TopVideoInfo     *json.RawMessage `json:"top_video_info"`
	Type             int32            `json:"type"`
	Words            int64            `json:"words"`
}

type ArticleItem

type ArticleItem struct {
	ID          int64      `json:"id"`
	Title       string     `json:"title"`
	State       int32      `json:"state"`
	PublishTime int64      `json:"publish_time"`
	Words       int64      `json:"words"`
	ImageURLs   []string   `json:"image_urls"`
	Category    Category   `json:"category"`
	Categories  []Category `json:"categories"`
	Summary     string     `json:"summary"`
	Stats       *Stats     `json:"stats"`
	LikeState   *int32     `json:"like_state"`
}

type Articles

type Articles struct {
	List      Collection    `json:"list"`
	Articles  []ArticleItem `json:"articles"`
	Author    Author        `json:"author"`
	Last      ArticleItem   `json:"last"`
	Attention bool          `json:"attention"`
}

type ArticlesInfoParams

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

func NewArticlesInfoParams

func NewArticlesInfoParams(id uint64) (ArticlesInfoParams, error)

func (ArticlesInfoParams) EncodeQuery

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

type Author

type Author struct {
	MID            ids.MID         `json:"mid"`
	Name           string          `json:"name"`
	Face           string          `json:"face"`
	Level          int32           `json:"level"`
	Fans           int64           `json:"fans"`
	OfficialVerify OfficialVerify  `json:"official_verify"`
	Nameplate      json.RawMessage `json:"nameplate"`
	Pendant        json.RawMessage `json:"pendant"`
	VIP            AuthorVIP       `json:"vip"`
}

type AuthorVIP

type AuthorVIP struct {
	Type      int32            `json:"type"`
	Status    int32            `json:"status"`
	DueDate   int64            `json:"due_date"`
	PayType   int32            `json:"vip_pay_type"`
	ThemeType int32            `json:"theme_type"`
	Label     *json.RawMessage `json:"label"`
}

type CardData

type CardData map[string]CardItem

type CardItem

type CardItem struct {
	Video   *VideoCard
	Article *ArticleCard
	Live    *LiveCard
	Raw     json.RawMessage
}

CardItem is one typed article embed. Raw is populated only when Bilibili returns an unknown or schema-incompatible card variant.

func (CardItem) Kind

func (item CardItem) Kind() CardKind

func (*CardItem) UnmarshalJSON

func (item *CardItem) UnmarshalJSON(data []byte) error

type CardKind

type CardKind string
const (
	CardVideo   CardKind = "video"
	CardArticle CardKind = "article"
	CardLive    CardKind = "live"
	CardUnknown CardKind = "unknown"
)

type CardsParams

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

func NewCardsParams

func NewCardsParams(cardIDs string) (CardsParams, error)

func (CardsParams) EncodeQuery

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

func (CardsParams) WithWebLocation

func (p CardsParams) WithWebLocation(location string) (CardsParams, error)

type Category

type Category struct {
	ID       int32  `json:"id"`
	Name     string `json:"name"`
	ParentID int32  `json:"parent_id"`
}

type Client

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

Client provides article-domain operations.

func NewClient

func NewClient(client *core.Client) Client

NewClient binds the article module to a shared client.

func (Client) Articles

func (a Client) Articles(ctx context.Context, params ArticlesInfoParams) (Articles, error)

func (Client) Cards

func (a Client) Cards(ctx context.Context, params CardsParams) (CardData, error)

func (Client) Info

func (a Client) Info(ctx context.Context, params InfoParams) (Info, error)

func (Client) View

func (a Client) View(ctx context.Context, params ViewParams) (View, error)

type Collection

type Collection struct {
	ID           uint64  `json:"id"`
	MID          ids.MID `json:"mid"`
	Name         string  `json:"name"`
	ImageURL     string  `json:"image_url"`
	UpdateTime   int64   `json:"update_time"`
	CreatedAt    int64   `json:"ctime"`
	PublishedAt  int64   `json:"publish_time"`
	Summary      string  `json:"summary"`
	Words        int64   `json:"words"`
	Read         int64   `json:"read"`
	ArticleCount int32   `json:"articles_count"`
	State        int32   `json:"state"`
	Reason       string  `json:"reason"`
	ApplyTime    string  `json:"apply_time"`
	CheckTime    string  `json:"check_time"`
}

type Info

type Info struct {
	Like            int32          `json:"like"`
	Attention       bool           `json:"attention"`
	Favorite        bool           `json:"favorite"`
	Coin            int32          `json:"coin"`
	Stats           Stats          `json:"stats"`
	Title           string         `json:"title"`
	BannerURL       string         `json:"banner_url"`
	MID             ids.MID        `json:"mid"`
	AuthorName      string         `json:"author_name"`
	IsAuthor        bool           `json:"is_author"`
	ImageURLs       []string       `json:"image_urls"`
	OriginImageURLs []string       `json:"origin_image_urls"`
	Shareable       bool           `json:"shareable"`
	ShowLaterWatch  bool           `json:"show_later_watch"`
	ShowSmallWindow bool           `json:"show_small_window"`
	InList          bool           `json:"in_list"`
	Previous        int64          `json:"pre"`
	Next            int64          `json:"next"`
	ShareChannels   []ShareChannel `json:"share_channels"`
	Type            int32          `json:"type"`
	VideoURL        string         `json:"video_url"`
	Location        string         `json:"location"`
	DisableShare    bool           `json:"disable_share"`
}

type InfoParams

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

func NewInfoParams

func NewInfoParams(id ids.CVID) InfoParams

func (InfoParams) EncodeQuery

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

type LiveCard

type LiveCard struct {
	AreaName       string     `json:"area_v2_name"`
	Cover          string     `json:"cover"`
	Face           string     `json:"face"`
	LiveStatus     int32      `json:"live_status"`
	Online         int64      `json:"online"`
	Pendant        string     `json:"pendent_ru"`
	PendantColor   string     `json:"pendent_ru_color"`
	PendantPicture string     `json:"pendent_ru_pic"`
	Role           int32      `json:"role"`
	RoomID         ids.RoomID `json:"room_id"`
	Title          string     `json:"title"`
	UID            ids.MID    `json:"uid"`
	Name           string     `json:"uname"`
}

type Media

type Media struct {
	Area     string `json:"area"`
	Cover    string `json:"cover"`
	MediaID  int64  `json:"media_id"`
	Score    int32  `json:"score"`
	SeasonID int64  `json:"season_id"`
	Spoiler  int32  `json:"spoiler"`
	Title    string `json:"title"`
	TypeID   int32  `json:"type_id"`
	TypeName string `json:"type_name"`
}

type OfficialVerify

type OfficialVerify struct {
	Type int32  `json:"type"`
	Desc string `json:"desc"`
}

type ShareChannel

type ShareChannel struct {
	Name    string `json:"name"`
	Picture string `json:"picture"`
	Channel string `json:"share_channel"`
}

type Stats

type Stats struct {
	Coin     int64 `json:"coin"`
	Dislike  int64 `json:"dislike"`
	Dynamic  int64 `json:"dynamic"`
	Favorite int64 `json:"favorite"`
	Like     int64 `json:"like"`
	Reply    int64 `json:"reply"`
	Share    int64 `json:"share"`
	View     int64 `json:"view"`
}

type Tag

type Tag struct {
	ID   int32  `json:"tid"`
	Name string `json:"name"`
}

type VideoCard

type VideoCard struct {
	AID         ids.AID        `json:"aid"`
	BVID        ids.BVID       `json:"bvid"`
	CID         ids.CID        `json:"cid"`
	Copyright   int32          `json:"copyright"`
	Picture     string         `json:"pic"`
	CreatedAt   int64          `json:"ctime"`
	Description string         `json:"desc"`
	Dimension   VideoDimension `json:"dimension"`
	Duration    int64          `json:"duration"`
	Dynamic     string         `json:"dynamic"`
	Owner       VideoOwner     `json:"owner"`
	PublishedAt int64          `json:"pubdate"`
	Rights      VideoRights    `json:"rights"`
	ShortLink   string         `json:"short_link_v2"`
	Stat        VideoStat      `json:"stat"`
	State       int32          `json:"state"`
	TID         int32          `json:"tid"`
	Title       string         `json:"title"`
	TypeName    string         `json:"tname"`
	Videos      int32          `json:"videos"`
	VTSwitch    bool           `json:"vt_switch"`
}

type VideoDimension

type VideoDimension struct {
	Height int32 `json:"height"`
	Rotate int32 `json:"rotate"`
	Width  int32 `json:"width"`
}

type VideoOwner

type VideoOwner struct {
	Face string  `json:"face"`
	MID  ids.MID `json:"mid"`
	Name string  `json:"name"`
}

type VideoRights

type VideoRights struct {
	ArcPay        int32 `json:"arc_pay"`
	Autoplay      int32 `json:"autoplay"`
	BP            int32 `json:"bp"`
	Download      int32 `json:"download"`
	Electric      int32 `json:"elec"`
	HD5           int32 `json:"hd5"`
	IsCooperation int32 `json:"is_cooperation"`
	Movie         int32 `json:"movie"`
	NoBackground  int32 `json:"no_background"`
	NoReprint     int32 `json:"no_reprint"`
	Pay           int32 `json:"pay"`
	PayFreeWatch  int32 `json:"pay_free_watch"`
	UGCPay        int32 `json:"ugc_pay"`
	UGCPayPreview int32 `json:"ugc_pay_preview"`
}

type VideoStat

type VideoStat struct {
	AID      ids.AID `json:"aid"`
	Coin     int64   `json:"coin"`
	Danmaku  int64   `json:"danmaku"`
	Dislike  int64   `json:"dislike"`
	Favorite int64   `json:"favorite"`
	HisRank  int32   `json:"his_rank"`
	Like     int64   `json:"like"`
	NowRank  int32   `json:"now_rank"`
	Reply    int64   `json:"reply"`
	Share    int64   `json:"share"`
	View     int64   `json:"view"`
	VT       int32   `json:"vt"`
	VV       int32   `json:"vv"`
}

type View

type View struct {
	ActID             int64            `json:"act_id"`
	ApplyTime         string           `json:"apply_time"`
	Attributes        *int32           `json:"attributes"`
	AuthenMark        *json.RawMessage `json:"authenMark"`
	Author            Author           `json:"author"`
	BannerURL         string           `json:"banner_url"`
	Categories        []Category       `json:"categories"`
	Category          Category         `json:"category"`
	CheckState        int32            `json:"check_state"`
	CheckTime         string           `json:"check_time"`
	Content           string           `json:"content"`
	ContentPictures   *json.RawMessage `json:"content_pic_list"`
	CoverAID          int64            `json:"cover_avid"`
	CreatedAt         int64            `json:"ctime"`
	Dispute           *json.RawMessage `json:"dispute"`
	DynamicID         string           `json:"dyn_id_str"`
	Dynamic           *string          `json:"dynamic"`
	ID                ids.CVID         `json:"id"`
	ImageURLs         []string         `json:"image_urls"`
	IsLike            bool             `json:"is_like"`
	Keywords          string           `json:"keywords"`
	List              *Collection      `json:"list"`
	Media             Media            `json:"media"`
	ModifiedAt        int64            `json:"mtime"`
	Opus              *json.RawMessage `json:"opus"`
	OriginImageURLs   []string         `json:"origin_image_urls"`
	OriginTemplateID  int32            `json:"origin_template_id"`
	Original          int32            `json:"original"`
	PrivatePublish    int32            `json:"private_pub"`
	PublishTime       int64            `json:"publish_time"`
	Reprint           int32            `json:"reprint"`
	State             int32            `json:"state"`
	Stats             Stats            `json:"stats"`
	Summary           string           `json:"summary"`
	Tags              []Tag            `json:"tags"`
	TemplateID        int32            `json:"template_id"`
	Title             string           `json:"title"`
	TopVideoInfo      *json.RawMessage `json:"top_video_info"`
	TotalArticleCount int64            `json:"total_art_num"`
	Type              int32            `json:"type"`
	VersionID         int64            `json:"version_id"`
	Words             int64            `json:"words"`
}

type ViewParams

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

func NewViewParams

func NewViewParams(id ids.CVID) ViewParams

func (ViewParams) EncodeQuery

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

func (ViewParams) WithGaiaSource

func (p ViewParams) WithGaiaSource(source string) (ViewParams, error)

Jump to

Keyboard shortcuts

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