bilibili

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Overview

Edited from annie

Edited from annie

Index

Constants

View Source
const BrokenVideoCover = "http://i0.hdslb.com/bfs/archive/be27fd62c99036dce67efface486fb0a88ffed06.jpg"

Variables

This section is empty.

Functions

func Cookies

func Cookies(v url.Values) string

func DownloadVideo added in v1.2.0

func DownloadVideo(videoData VideoData, vData DownloadVideoRequest, basePath, cookies string, callback func(pg *utils.Progress)) error

func GetCookiesString

func GetCookiesString(link string) string

func GetUserFavoriteListReport

func GetUserFavoriteListReport(mid string, currentUser bool) string

func GetUserMID

func GetUserMID(cookies string) string

func IterateFavoriteList

func IterateFavoriteList(mid string, cookies string, callback func(key, value string, data interface{}))

func SaveFile added in v1.2.0

func SaveFile(urlData VideoURL, fName, fPath, cookies string, pg *utils.Progress) error

func TestFavoriteList added in v1.2.0

func TestFavoriteList() bool

func TestFavoriteListItem added in v1.2.0

func TestFavoriteListItem() bool

func TestLoginInfo added in v1.2.0

func TestLoginInfo() bool

func TestLoginQR added in v1.2.0

func TestLoginQR() bool

func TestMainSite added in v1.2.0

func TestMainSite() bool

func TestPage added in v1.2.0

func TestPage(url string) bool

func TestSpace added in v1.2.0

func TestSpace() bool

func TestVideoPage added in v1.2.0

func TestVideoPage() bool

Types

type DownloadVideoRequest added in v1.2.0

type DownloadVideoRequest struct {
	Title    string           `json:"title"`
	FavTitle string           `json:"fav_title"`
	Aid      string           `json:"aid"`
	Page     RequestVideoPage `json:"page"`
}

type FavoriteListItem

type FavoriteListItem struct {
	Code    int                  `json:"code"`
	Message string               `json:"message"`
	TTL     int                  `json:"ttl"`
	Data    favoriteListItemData `json:"data"`
}

type FavoriteListItemDetail added in v1.2.0

type FavoriteListItemDetail struct {
	MediaID      int                     `json:"media_id"`
	FID          int                     `json:"fid"`
	MID          int                     `json:"mid"`
	Name         string                  `json:"name"`
	MaxCount     int                     `json:"max_count"`
	CurrentCount int                     `json:"cur_count"`
	AttenCount   int                     `json:"atten_count"`
	Favoured     int                     `json:"favoured"`
	State        int                     `json:"state"`
	Ctime        int                     `json:"ctime"`
	Mtime        int                     `json:"mtime"`
	Cover        []favoriteListItemCover `json:"cover"`
}

func GetFavoriteList

func GetFavoriteList(mid string, cookies string) ([]FavoriteListItemDetail, error)

type FavoriteListItemVideo

type FavoriteListItemVideo struct {
	AID            int                            `json:"aid"`
	Videos         int                            `json:"videos"`
	TID            int                            `json:"tid"`
	TName          string                         `json:"tname"`
	Copyright      int                            `json:"copyright"`
	Cover          string                         `json:"pic"`
	Title          string                         `json:"title"`
	PubDate        int                            `json:"pubdate"`
	CTime          int                            `json:"ctime"`
	Description    string                         `json:"desc"`
	State          int                            `json:"state"`
	Attribute      int                            `json:"attribute"`
	Duration       int                            `json:"duration"`
	Owner          OwnerUser                      `json:"owner"`
	Stat           favoriteListItemVideoStat      `json:"stat"`
	Dynamic        string                         `json:"dynamic"`
	CID            int                            `json:"cid"`
	Dimension      favoriteListItemVideoDimension `json:"dimension"`
	FavoriteTime   int                            `json:"fav_at"`
	PlayNum        string                         `json:"play_num"`
	HighlightTitle string                         `json:"highlight_title"`
}

func GetFavoriteListItems

func GetFavoriteListItems(mid, fid, pn, cookies string) ([]FavoriteListItemVideo, error)

type MIDInfo

type MIDInfo struct {
	Mid        int            `json:"mid"`
	Name       string         `json:"name"`
	Sex        string         `json:"sex"`
	Face       string         `json:"face"`
	Sign       string         `json:"sign"`
	Rank       int            `json:"rank"`
	Level      int            `json:"level"`
	Jointime   int            `json:"jointime"`
	Moral      int            `json:"moral"`
	Silence    int            `json:"silence"`
	Birthday   string         `json:"birthday"`
	Coins      float64        `json:"coins"`
	FansBadge  bool           `json:"fans_badge"`
	Official   officialStatus `json:"official"`
	Vip        vipStatus      `json:"vip"`
	IsFollowed bool           `json:"is_followed"`
	TopPhoto   string         `json:"top_photo"`
	Theme      interface{}    `json:"theme"`
}

func GetMIDInfo

func GetMIDInfo(mid string) (MIDInfo, error)

type MIDResponse

type MIDResponse struct {
	Code    int     `json:"code"`
	Message string  `json:"message"`
	TTL     int     `json:"ttl"`
	Data    MIDInfo `json:"data"`
}

type MySpaceResponse

type MySpaceResponse struct {
	Code    int                 `json:"code"`
	Message string              `json:"message"`
	TTL     int                 `json:"ttl"`
	Data    mySpaceResponseData `json:"data"`
}

type OwnerUser

type OwnerUser struct {
	MID  int    `json:"mid"`
	Name string `json:"name"`
	Face string `json:"face"`
}

type QRCode

type QRCode struct {
	QRLogin qrLogin
	Png     []byte
	Image   string
}

func GetLoginQRCode

func GetLoginQRCode() QRCode

func (QRCode) Check

func (this QRCode) Check() (bool, string, error)

func (QRCode) WaitForLogin

func (this QRCode) WaitForLogin() (url.Values, bool)

type RequestVideoPage added in v1.2.0

type RequestVideoPage struct {
	Page     int    `json:"page"`
	PageName string `json:"page_name"`
	CID      string `json:"cid"`
}

type VideoData added in v1.2.0

type VideoData struct {
	Site  string `json:"site"`
	Title string `json:"title"`
	Type  string `json:"type"`
	// each stream has it's own URLs and Quality
	Streams map[string]VideoStream `json:"streams"`

	// Err is used to record whether an error occurred when extracting data.
	// It is used to record the error information corresponding to each url when extracting the list data.
	// NOTE(iawia002): err is only used in VideoData list
	Err error `json:"-"`
	// VideoURL is used to record the address of this download
	URL string `json:"url"`
	// contains filtered or unexported fields
}

func EmptyVideoData added in v1.2.0

func EmptyVideoData(url string, err error) VideoData

func ExtractVideo added in v1.2.0

func ExtractVideo(data DownloadVideoRequest, cookies string) VideoData

提取 bilibili 视频

type VideoDimension added in v1.2.0

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

type VideoPage

type VideoPage struct {
	CID       int            `json:"cid"`
	Page      int            `json:"page"`
	From      string         `json:"from"`
	Part      string         `json:"part"`
	Duration  int64          `json:"duration"`
	Vid       string         `json:"vid"`
	Weblink   string         `json:"weblink"`
	Dimension VideoDimension `json:"dimension"`
}

func GetVideoPages

func GetVideoPages(aid string) ([]VideoPage, error)

type VideoPageList added in v1.2.0

type VideoPageList struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	TTL     int         `json:"ttl"`
	Data    []VideoPage `json:"data"`
}

type VideoStream added in v1.2.0

type VideoStream struct {
	// [VideoURL: {VideoURL, Size, Ext}, ...]
	// Some video files have multiple fragments
	// and support for downloading multiple image files at once
	URLs    []VideoURL `json:"urls"`
	Quality string     `json:"quality"`
	// total size of all urls
	Size int64 `json:"size"`
	// contains filtered or unexported fields
}

type VideoURL added in v1.2.0

type VideoURL struct {
	URL  string `json:"url"`
	Size int64  `json:"size"`
	Ext  string `json:"ext"`
}

Jump to

Keyboard shortcuts

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