Documentation ¶
Index ¶
- Constants
- Variables
- func LoginWithQRCode(ctx context.Context, key string) (bilibili.QRCodeStatus, *http.Cookie, error)
- func LoginWithSMS(ctx context.Context, tel, code, captchaKey string) (*http.Cookie, error)
- func Match(url string) (t string, id string, err error)
- func NewSMS(ctx context.Context, tel, token, challenge, validate string) (captchaKey string, err error)
- type CaptchaResp
- type Client
- func (c *Client) GetDashPGCURL(epid, cid uint64, conf ...GetDashVideoURLConfig) (*mpd.MPD, *mpd.MPD, error)
- func (c *Client) GetDashVideoURL(aid uint64, bvid string, cid uint64, conf ...GetDashVideoURLConfig) (*mpd.MPD, *mpd.MPD, error)
- func (c *Client) GetPGCURL(epid, cid uint64, conf ...GetVideoURLConfig) (*VideoURL, error)
- func (c *Client) GetSubtitles(aid uint64, bvid string, cid uint64) ([]*Subtitle, error)
- func (c *Client) GetVideoURL(aid uint64, bvid string, cid uint64, conf ...GetVideoURLConfig) (*VideoURL, error)
- func (c *Client) NewRequest(method, url string, body io.Reader, conf ...RequestOption) (req *http.Request, err error)
- func (c *Client) ParsePGCPage(epid, season_id uint64) (*VideoPageInfo, error)
- func (c *Client) ParseVideoPage(aid uint64, bvid string, conf ...ParseVideoPageConfig) (*VideoPageInfo, error)
- func (c *Client) SetCookies(cookies []*http.Cookie)
- func (c *Client) UserInfo() (*UserInfo, error)
- type ClientConfig
- type GetDashVideoURLConf
- type GetDashVideoURLConfig
- type GetVideoURLConf
- type GetVideoURLConfig
- type Nav
- type ParseVideoPageConf
- type ParseVideoPageConfig
- type RQCode
- type RequestConfig
- type RequestOption
- type Subtitle
- type UserInfo
- type VideoInfo
- type VideoPageInfo
- type VideoURL
Constants ¶
Variables ¶
View Source
var ( ErrQRCodeExpired = errors.New("qr code expired") ErrQRCodeScanned = errors.New("qr code scanned") ErrQRCodeNotScanned = errors.New("qr code not scanned") )
View Source
var ( BVRegex = regexp.MustCompile(`^(?:https://www\.bilibili\.com/video/)?((?:bv|bV|Bv|BV)\w+)(?:[/\?].*)?$`) ARegex = regexp.MustCompile(`^(?:https://www\.bilibili\.com/video/)?(?:av|aV|Av|AV)(\d+)(?:[/\?].*)?$`) SSRegex = regexp.MustCompile(`^(?:https://www\.bilibili\.com/bangumi/play/)?(?:ss|sS|Ss|SS)(\d+)(?:[/\?].*)?$`) EPRegex = regexp.MustCompile(`^(?:https://www\.bilibili\.com/bangumi/play/)?(?:ep|eP|Ep|EP)(\d+)(?:[/\?].*)?$`) B23Regex = regexp.MustCompile(`^(https://)?b23\.tv/(\w+)$`) )
Functions ¶
func LoginWithQRCode ¶
func LoginWithSMS ¶
Types ¶
type CaptchaResp ¶
type CaptchaResp struct { Token string `json:"token"` Gt string `json:"gt"` Challenge string `json:"challenge"` }
func NewCaptcha ¶
func NewCaptcha(ctx context.Context) (*CaptchaResp, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetDashPGCURL ¶
func (*Client) GetDashVideoURL ¶
func (c *Client) GetDashVideoURL(aid uint64, bvid string, cid uint64, conf ...GetDashVideoURLConfig) (*mpd.MPD, *mpd.MPD, error)
https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/video/videostream_url.md
func (*Client) GetPGCURL ¶
func (c *Client) GetPGCURL(epid, cid uint64, conf ...GetVideoURLConfig) (*VideoURL, error)
func (*Client) GetSubtitles ¶
https://api.bilibili.com/x/player/wbi/v2?bvid=BV1sw411Q7dr&cid=1248205613
func (*Client) GetVideoURL ¶
func (c *Client) GetVideoURL(aid uint64, bvid string, cid uint64, conf ...GetVideoURLConfig) (*VideoURL, error)
https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/video/videostream_url.md
func (*Client) NewRequest ¶
func (*Client) ParsePGCPage ¶
func (c *Client) ParsePGCPage(epid, season_id uint64) (*VideoPageInfo, error)
func (*Client) ParseVideoPage ¶
func (c *Client) ParseVideoPage(aid uint64, bvid string, conf ...ParseVideoPageConfig) (*VideoPageInfo, error)
func (*Client) SetCookies ¶
type ClientConfig ¶
type ClientConfig func(*Client)
func WithContext ¶
func WithContext(ctx context.Context) ClientConfig
func WithHttpClient ¶
func WithHttpClient(httpClient *http.Client) ClientConfig
type GetDashVideoURLConf ¶
type GetDashVideoURLConf struct {
HDR bool
}
type GetDashVideoURLConfig ¶
type GetDashVideoURLConfig func(*GetDashVideoURLConf)
func WithHDR ¶
func WithHDR(hdr bool) GetDashVideoURLConfig
type GetVideoURLConf ¶
type GetVideoURLConf struct {
Quality uint64
}
type GetVideoURLConfig ¶
type GetVideoURLConfig func(*GetVideoURLConf)
func WithQuality ¶
func WithQuality(q uint64) GetVideoURLConfig
type Nav ¶
type Nav struct { bool `json:"isLogin"` EmailVerified int `json:"email_verified"` Face string `json:"face"` FaceNft int `json:"face_nft"` FaceNftType int `json:"face_nft_type"` LevelInfo struct { CurrentLevel int `json:"current_level"` CurrentMin int `json:"current_min"` CurrentExp int `json:"current_exp"` } `json:"level_info"` Mid int `json:"mid"` MobileVerified int `json:"mobile_verified"` // Money int `json:"money"` // 可能为float Moral int `json:"moral"` Official struct { Role int `json:"role"` Title string `json:"title"` Desc string `json:"desc"` Type int `json:"type"` } `json:"official"` OfficialVerify struct { Type int `json:"type"` Desc string `json:"desc"` } `json:"officialVerify"` Pendant struct { Pid int `json:"pid"` Name string `json:"name"` Image string `json:"image"` Expire int `json:"expire"` ImageEnhance string `json:"image_enhance"` ImageEnhanceFrame string `json:"image_enhance_frame"` NPid int `json:"n_pid"` } `json:"pendant"` Scores int `json:"scores"` Uname string `json:"uname"` VipDueDate int64 `json:"vipDueDate"` VipStatus int `json:"vipStatus"` VipType int `json:"vipType"` VipPayType int `json:"vip_pay_type"` VipThemeType int `json:"vip_theme_type"` VipLabel struct { Path string `json:"path"` Text string `json:"text"` LabelTheme string `json:"label_theme"` TextColor string `json:"text_color"` BgStyle int `json:"bg_style"` BgColor string `json:"bg_color"` BorderColor string `json:"border_color"` UseImgLabel bool `json:"use_img_label"` ImgLabelURIHans string `json:"img_label_uri_hans"` ImgLabelURIHant string `json:"img_label_uri_hant"` ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"` ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"` } `json:"vip_label"` VipAvatarSubscript int `json:"vip_avatar_subscript"` VipNicknameColor string `json:"vip_nickname_color"` Vip struct { Type int `json:"type"` Status int `json:"status"` DueDate int64 `json:"due_date"` VipPayType int `json:"vip_pay_type"` ThemeType int `json:"theme_type"` Label struct { Path string `json:"path"` Text string `json:"text"` LabelTheme string `json:"label_theme"` TextColor string `json:"text_color"` BgStyle int `json:"bg_style"` BgColor string `json:"bg_color"` BorderColor string `json:"border_color"` UseImgLabel bool `json:"use_img_label"` ImgLabelURIHans string `json:"img_label_uri_hans"` ImgLabelURIHant string `json:"img_label_uri_hant"` ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"` ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"` } `json:"label"` AvatarSubscript int `json:"avatar_subscript"` NicknameColor string `json:"nickname_color"` Role int `json:"role"` AvatarSubscriptURL string `json:"avatar_subscript_url"` TvVipStatus int `json:"tv_vip_status"` TvVipPayType int `json:"tv_vip_pay_type"` TvDueDate int `json:"tv_due_date"` } `json:"vip"` Wallet struct { Mid int `json:"mid"` BcoinBalance float64 `json:"bcoin_balance"` CouponBalance int `json:"coupon_balance"` CouponDueTime int `json:"coupon_due_time"` } `json:"wallet"` HasShop bool `json:"has_shop"` ShopURL string `json:"shop_url"` AllowanceCount int `json:"allowance_count"` AnswerStatus int `json:"answer_status"` IsSeniorMember int `json:"is_senior_member"` WbiImg struct { ImgURL string `json:"img_url"` SubURL string `json:"sub_url"` } `json:"wbi_img"` IsJury bool `json:"is_jury"` } `json:"data"` }IsLogin
type ParseVideoPageConf ¶
type ParseVideoPageConf struct {
GetSections bool
}
type ParseVideoPageConfig ¶
type ParseVideoPageConfig func(*ParseVideoPageConf)
func WithGetSections ¶
func WithGetSections(GetSections bool) ParseVideoPageConfig
type RequestConfig ¶
type RequestConfig struct {
// contains filtered or unexported fields
}
type RequestOption ¶
type RequestOption func(*RequestConfig)
func WithoutWbi ¶
func WithoutWbi() RequestOption
type VideoPageInfo ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.