Documentation
¶
Overview ¶
Package danmaku contains validated parameters for Bilibili danmaku JSON, XML, and protobuf endpoints.
Index ¶
- type AdvState
- type AdvStateParams
- type Client
- func (d Client) AdvState(ctx context.Context, params AdvStateParams) (AdvState, error)
- func (d Client) HistoryDates(ctx context.Context, params HistoryDatesParams) ([]string, error)
- func (d Client) HistoryXMLBytes(ctx context.Context, params HistoryBytesParams) ([]byte, error)
- func (d Client) MobileSegment(ctx context.Context, params SegmentParams) ([]byte, error)
- func (d Client) Snapshot(ctx context.Context, params SnapshotParams) ([]string, error)
- func (d Client) ThumbupStats(ctx context.Context, params ThumbupStatsParams) (ThumbupStats, error)
- func (d Client) WebHistorySegment(ctx context.Context, params HistoryBytesParams) ([]byte, error)
- func (d Client) WebSegment(ctx context.Context, params SegmentParams) ([]byte, error)
- func (d Client) WebSegmentWBI(ctx context.Context, params SegmentParams) ([]byte, error)
- func (d Client) WebView(ctx context.Context, params WebViewParams) ([]byte, error)
- func (d Client) XMLList(ctx context.Context, params XMLListParams) (XML, error)
- func (d Client) XMLListSO(ctx context.Context, params XMLListParams) (XML, error)
- type Comment
- type CommentMeta
- type HistoryBytesParams
- type HistoryDatesParams
- type SegmentParams
- type SnapshotParams
- type ThumbupStat
- type ThumbupStats
- type ThumbupStatsParams
- type WebViewParams
- type XML
- type XMLListParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdvStateParams ¶
type AdvStateParams struct {
// contains filtered or unexported fields
}
func NewAdvStateParams ¶
func NewAdvStateParams(cid ids.CID) AdvStateParams
func (AdvStateParams) EncodeQuery ¶
func (p AdvStateParams) EncodeQuery() (url.Values, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides danmaku-domain operations.
func (Client) HistoryDates ¶
func (Client) HistoryXMLBytes ¶
func (Client) MobileSegment ¶
func (Client) ThumbupStats ¶
func (d Client) ThumbupStats(ctx context.Context, params ThumbupStatsParams) (ThumbupStats, error)
func (Client) WebHistorySegment ¶
func (Client) WebSegment ¶
WebSegment gets one raw protobuf danmaku segment. It intentionally does not attempt JSON envelope decoding; callers may decode it with the official DmSegMobileReply protobuf schema.
func (Client) WebSegmentWBI ¶
type Comment ¶
type Comment struct {
Parameters string `xml:"p,attr"`
Content string `xml:",chardata"`
Meta *CommentMeta `xml:"-"`
}
type CommentMeta ¶
type HistoryBytesParams ¶
type HistoryBytesParams struct {
// contains filtered or unexported fields
}
func NewHistoryBytesParams ¶
func NewHistoryBytesParams(typeID uint8, oid uint64, date string) (HistoryBytesParams, error)
func (HistoryBytesParams) EncodeQuery ¶
func (p HistoryBytesParams) EncodeQuery() (url.Values, error)
type HistoryDatesParams ¶
type HistoryDatesParams struct {
// contains filtered or unexported fields
}
func NewHistoryDatesParams ¶
func NewHistoryDatesParams(oid ids.CID, month string) (HistoryDatesParams, error)
func (HistoryDatesParams) EncodeQuery ¶
func (p HistoryDatesParams) EncodeQuery() (url.Values, error)
func (HistoryDatesParams) WithType ¶
func (p HistoryDatesParams) WithType(typeID uint8) (HistoryDatesParams, error)
type SegmentParams ¶
type SegmentParams struct {
// contains filtered or unexported fields
}
SegmentParams configures a real-time protobuf danmaku segment request.
func NewSegmentParams ¶
func NewSegmentParams(typeID uint8, oid uint64, segmentIndex uint32) (SegmentParams, error)
NewSegmentParams creates parameters with non-zero type, object ID, and segment index.
func (SegmentParams) EncodeQuery ¶
func (p SegmentParams) EncodeQuery() (url.Values, error)
EncodeQuery returns a new URL query containing the request parameters.
func (SegmentParams) WithAID ¶
func (p SegmentParams) WithAID(aid ids.AID) (SegmentParams, error)
WithAID returns a copy with the owning archive ID.
func (SegmentParams) WithPullMode ¶
func (p SegmentParams) WithPullMode(mode uint32) SegmentParams
WithPullMode returns a copy with an API pull-mode value.
func (SegmentParams) WithRange ¶
func (p SegmentParams) WithRange(start, end uint32) (SegmentParams, error)
WithRange returns a copy with an inclusive millisecond content range.
type SnapshotParams ¶
type SnapshotParams struct {
// contains filtered or unexported fields
}
func NewSnapshotByAID ¶
func NewSnapshotByAID(aid ids.AID) SnapshotParams
func NewSnapshotByBVID ¶
func NewSnapshotByBVID(bvid ids.BVID) SnapshotParams
func (SnapshotParams) EncodeQuery ¶
func (p SnapshotParams) EncodeQuery() (url.Values, error)
type ThumbupStat ¶
type ThumbupStats ¶
type ThumbupStats map[string]ThumbupStat
type ThumbupStatsParams ¶
type ThumbupStatsParams struct {
// contains filtered or unexported fields
}
func NewThumbupStatsParams ¶
func NewThumbupStatsParams(oid ids.CID, danmakuIDs ...uint64) (ThumbupStatsParams, error)
func (ThumbupStatsParams) EncodeQuery ¶
func (p ThumbupStatsParams) EncodeQuery() (url.Values, error)
type WebViewParams ¶
type WebViewParams struct {
// contains filtered or unexported fields
}
func NewWebViewParams ¶
func NewWebViewParams(typeID uint8, oid uint64) (WebViewParams, error)
func (WebViewParams) EncodeQuery ¶
func (p WebViewParams) EncodeQuery() (url.Values, error)
func (WebViewParams) WithAID ¶
func (p WebViewParams) WithAID(aid ids.AID) WebViewParams
type XML ¶
type XML struct {
XMLName xml.Name `xml:"i"`
ChatServer string `xml:"chatserver"`
ChatID string `xml:"chatid"`
Mission int32 `xml:"mission"`
MaxLimit int32 `xml:"maxlimit"`
State int32 `xml:"state"`
RealName int32 `xml:"real_name"`
Source string `xml:"source"`
Comments []Comment `xml:"d"`
}
func ParseDeflateXML ¶
ParseDeflateXML decodes a raw-deflate danmaku response and parses each comment's compact p attribute into typed metadata.
type XMLListParams ¶
type XMLListParams struct {
// contains filtered or unexported fields
}
func NewXMLListParams ¶
func NewXMLListParams(cid ids.CID) XMLListParams
func (XMLListParams) CommentURL ¶
func (p XMLListParams) CommentURL() (string, error)
func (XMLListParams) EncodeQuery ¶
func (p XMLListParams) EncodeQuery() (url.Values, error)