types

package
v0.0.0-...-799cb51 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioStream

type AudioStream struct {
	AudioID   int    `json:"audioID"`
	Size      int    `json:"size"`
	Extension string `json:"extension"`
	URL       string `json:"url"`
	BackupURL string `json:"backupURL"`
	Codecs    string `json:"codecs"`
}

AudioStream 音频流相关信息

type AudioStreamList

type AudioStreamList []AudioStream

AudioStreamList 音频流列表

type Data

type Data struct {
	// 页面的唯一性标识
	ID    string `json:"id"`
	Title string `json:"title"`
	Cover string `json:"cover"`
	// 视频页面的URL
	URL           string            `json:"url"`
	Site          string            `json:"site"`
	VideoDataList []SingleVideoData `json:"videoDataList"`
}

Data 当前页面数据的汇总 每个extractor下载到的数据,用同样的容器进行汇总,最后统一进行下载处理

type DataType

type DataType string

DataType indicates the type of extracted data, eg: video or image.

const (
	// DataTypeVideo indicates the type of extracted data is the video.
	DataTypeVideo DataType = "video"
	// DataTypeImage indicates the type of extracted data is the image.
	DataTypeImage DataType = "image"
)

type DownloadStreamPack

type DownloadStreamPack struct {
	HasVideo bool
	HasAudio bool
	VideoStream
	AudioStream
	AudioPath string
	VideoPath string
	// Index       int
	// OutputPath 输出路径是最后生成文件的路径。AudioPath和VideoPath只是中间产物的路径
	OutputPath string
}

DownloadStreamPack 下载视频和音频需要的信息

type Extractor

type Extractor interface {
	Extract(url string, option Options) (vpd VPDor, err error)
}

Extractor 视频数据提取相关操作,封装起来,到时候用正则匹配map的字符串,运用接口来调用对应网站的解析函数

type Options

type Options struct {
	// Playlist indicates if we need to extract the whole playlist rather than the single video.
	Playlist bool
	// Items defines wanted items from a playlist. Separated by commas like: 1,5,6,8-10.
	Items string
	// ItemStart defines the starting item of a playlist,start from 1
	ItemStart int
	// ItemEnd defines the ending item of a playlist.
	ItemEnd int
	// Format 用固定格式的字符串指定下载视频的格式
	Format string
	//ListFormats 是否显示可下载格式
	ListFormats bool
	// OutputDirectory 下载文件的目录
	OutputDirectory string
	// 	下载的文件名,使用golang模板进行解析
	OutputFilename string
	// Verbose 是否开启更复杂的输出,适用于检查bug
	Verbose bool
	// ThreadNumber defines how many threads will use in the extraction, only works when Playlist is true.
	ThreadNumber int
	Cookie       string

	// EpisodeTitleOnly indicates file name of each bilibili episode doesn't include the playlist title
	EpisodeTitleOnly bool

	YoukuCcode    string
	YoukuCkey     string
	YoukuPassword string
}

Options defines optional options that can be used in the extraction function. 命令行参数,在提取下载链接及节目信息的过程中起作用

type SingleVideoData

type SingleVideoData struct {
	//Title  视频页的标题,如果是合集或者番剧的话,就是合集和番剧的标题.
	Title           string `json:"title"`
	VideoStreamList `json:"videoStreamList"`
	AudioStreamList `json:"audioStreamList"`
	// 请求获取视频流和音频流的api链接
	URL      string `json:"url"`
	CoverURL string `json:"coverUrl"`
	Page     int    `json:"page"`
	//视频的时长,单位是秒
	Duration int `json:"duration"`
	// UpDate 视频上传的日期
	PubDate string `json:"pubDate"`
	// UpTime 视频上传的准确时间,包括日期+时分秒。
	PubTime   string    `json:"pubTime"`
	VideoInfo VideoInfo `json:"videoInfo"`
}

SingleVideoData 单个视频页单个视频的相关信息

type VPDor

type VPDor interface {
	ShowAvailableFormats(extractOption Options)
	// saveJSON(path string) (err error)
	// loadJSON(path string) (err error)
	SelectStream(selectString string, extractionOptions Options) (err error)
	Download(extractionOptions Options)
}

VPDor 视频页相关数据, 抽象了数据相关的操作。统一提取后的数据处理步骤

type VideoInfo

type VideoInfo struct {
	Ext           string
	ID            string
	Title         string
	PubDate       string
	PubTime       string
	FormatVID     string
	FormatAID     string
	PlaylistIndex string
}

VideoInfo 视频用来展示的相关信息

type VideoStream

type VideoStream struct {
	VideoID   int
	Size      int
	Width     int
	Height    int
	Extension string
	FrameRate int
	Codecs    string
	// 视频流的下载地址
	URL string
	// b站同一个视频流可能有一个额外的视频下载地址
	BackupURL string
}

VideoStream 一个视频流的相关信息

type VideoStreamList

type VideoStreamList []VideoStream

VideoStreamList 视频流的列表

Jump to

Keyboard shortcuts

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