Documentation ¶
Index ¶
- func CheckVideoURLOrID(urlOrId string) (videoId string, err error)
- func ClearDir(path string)
- func Download(parseResult *ParseResult, index int, downDirPath string, tempDirPath string) (outputPath string, err error)
- func DownloadFile(url string, path string) error
- func ExpiresToTime(expires float64) time.Time
- func FileExists(path string) bool
- func GetCookieValue(filePath string) (string, error)
- func InitDir(path string)
- func Login() (*network.Cookie, error)
- func MakeVideoURL(videoId string) string
- func SaveCookie(cookie *network.Cookie, cookieSavePath string)
- type AudioItem
- type FormatItem
- type InitialState
- type ParseResult
- type PlayInfo
- type PlayInfoData
- type StaffItem
- type Stat
- type VideoData
- type VideoItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckVideoURLOrID ¶
CheckVideoURLOrID 校验视频链接或视频 ID 格式
func Download ¶
func Download(parseResult *ParseResult, index int, downDirPath string, tempDirPath string) (outputPath string, err error)
Download 下载并合并指定的视频和音频,保存到输出目录
func DownloadFile ¶
func ExpiresToTime ¶
ExpiresToTime 将 network.Cookie.Expires 转换为 Time
func GetCookieValue ¶
GetCookieValue 获取文件中保存的可用 Cookie
func SaveCookie ¶
SaveCookie 将 Cookie 以 JSON 格式保存到 cookie 文件中
Types ¶
type FormatItem ¶
type InitialState ¶
type InitialState struct {
Data VideoData `json:"videoData"`
}
type ParseResult ¶
type ParseResult struct { PlayInfoData VideoData }
func ParseVideo ¶
func ParseVideo(videoURL string, cookieValue string) (*ParseResult, error)
ParseVideo 解析视频下载地址
type PlayInfo ¶
type PlayInfo struct {
Data PlayInfoData `json:"data"`
}
type PlayInfoData ¶
type PlayInfoData struct { SupportFormats []FormatItem `json:"support_formats"` Dash struct { Audio []AudioItem `json:"audio"` Video []VideoItem `json:"video"` } `json:"dash"` }
type VideoData ¶
type VideoData struct { // 视频标题 Title string `json:"title"` // 创作团队 Staff []StaffItem `json:"staff"` // 视频统计信息 Stat Stat `json:"stat"` // 视频描述 Desc string `json:"desc"` // 发布时间 Pubdate int `json:"pubdate"` Owner struct { Name string `json:"name"` } `json:"owner"` }
func (VideoData) PubdateString ¶
type VideoItem ¶
type VideoItem struct { // 视频分辨率 ID Id int `json:"id"` // 下载地址 BaseUrl string `json:"baseUrl"` // 备用下载地址 BackupUrl []string `json:"backupUrl"` // 编解码器 Codecs string `json:"codecs"` // 比特率 Bandwidth int `json:"bandwidth"` }
func (VideoItem) Description ¶
func (video VideoItem) Description(formats []FormatItem) string
Description 视频分辨率描述
Click to show internal directories.
Click to hide internal directories.