Documentation ¶
Index ¶
- Constants
- Variables
- func AesDecrypt(seq uint64, encrypted []byte, encInfo *EncryptInfo) ([]byte, error)
- func GetFileNameFromUrl(u string) string
- func GetWd() string
- func IsContextCancel(ctx context.Context) bool
- func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
- func ParseProxyFormat(origin string) (after string, urlObj *url.URL, errMsg string)
- func RunDownload_Req_ToCurlStr(req StartDownload_Req) string
- func UrlHasSuffix(urlS string, suff string) bool
- type DownloadEnv
- func (this *DownloadEnv) CloseEnv()
- func (this *DownloadEnv) GetIsCancel() bool
- func (this *DownloadEnv) GetStatus() (resp GetStatus_Resp)
- func (this *DownloadEnv) SleepDur(d time.Duration)
- func (this *DownloadEnv) StartDownload(req StartDownload_Req) (errMsg string)
- func (this *DownloadEnv) WaitDownloadFinish() GetStatus_Resp
- type EncryptInfo
- type GetStatus_Resp
- type M3u8Content
- type M3u8Part
- type MergeTsFileListToSingleMp4_Req
- type ParseCurl_Resp
- type SkipTsUnit
- type SpeedInfo
- type SpeedStatus
- func (this *SpeedStatus) DrawProgressBar(total int, current int)
- func (this *SpeedStatus) GetPercent() (percent int)
- func (this *SpeedStatus) GetTitle() (title string)
- func (this *SpeedStatus) ResetTotalBlockCount(count int)
- func (this *SpeedStatus) SetProgressBarTitle(title string)
- func (this *SpeedStatus) SpeedAdd1Block(byteCount int)
- func (this *SpeedStatus) SpeedRecent5sGetAndUpdate() (speed SpeedInfo)
- func (this *SpeedStatus) SpeedResetBytes()
- type StartDownload_Req
- type TsInfo
Constants ¶
View Source
const ( EncryptMethod_NONE = `NONE` EncryptMethod_AES128 = `AES-128` EncryptMethod_SIMPLE_AES = `SAMPLE-AES` // TODO )
https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.4
Variables ¶
View Source
var PNG_SIGN = []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}
Functions ¶
func AesDecrypt ¶
func AesDecrypt(seq uint64, encrypted []byte, encInfo *EncryptInfo) ([]byte, error)
func GetFileNameFromUrl ¶
func IsContextCancel ¶ added in v1.20.0
func MergeTsFileListToSingleMp4 ¶
func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
func ParseProxyFormat ¶ added in v1.20.0
func RunDownload_Req_ToCurlStr ¶
func RunDownload_Req_ToCurlStr(req StartDownload_Req) string
func UrlHasSuffix ¶
Types ¶
type DownloadEnv ¶ added in v1.20.0
type DownloadEnv struct {
// contains filtered or unexported fields
}
func (*DownloadEnv) CloseEnv ¶ added in v1.20.0
func (this *DownloadEnv) CloseEnv()
func (*DownloadEnv) GetIsCancel ¶ added in v1.20.0
func (this *DownloadEnv) GetIsCancel() bool
func (*DownloadEnv) GetStatus ¶ added in v1.20.0
func (this *DownloadEnv) GetStatus() (resp GetStatus_Resp)
func (*DownloadEnv) SleepDur ¶ added in v1.20.0
func (this *DownloadEnv) SleepDur(d time.Duration)
func (*DownloadEnv) StartDownload ¶ added in v1.20.0
func (this *DownloadEnv) StartDownload(req StartDownload_Req) (errMsg string)
func (*DownloadEnv) WaitDownloadFinish ¶ added in v1.20.0
func (this *DownloadEnv) WaitDownloadFinish() GetStatus_Resp
type EncryptInfo ¶
type GetStatus_Resp ¶ added in v1.20.0
type M3u8Content ¶
type M3u8Content struct {
PartList []M3u8Part `json:",omitempty"`
}
func M3u8Parse ¶
func M3u8Parse(content string) (info M3u8Content)
func (M3u8Content) GetPart ¶
func (info M3u8Content) GetPart(tag string) M3u8Part
type MergeTsFileListToSingleMp4_Req ¶
type MergeTsFileListToSingleMp4_Req struct { TsFileList []string OutputMp4 string Status *SpeedStatus Ctx context.Context }
type ParseCurl_Resp ¶
type ParseCurl_Resp struct { ErrMsg string DownloadReq StartDownload_Req }
func ParseCurl ¶
func ParseCurl(cmdList []string) (resp ParseCurl_Resp)
func ParseCurlStr ¶
func ParseCurlStr(s string) (resp ParseCurl_Resp)
type SkipTsUnit ¶ added in v1.24.3
func ParseSkipTsExpr ¶ added in v1.24.3
func ParseSkipTsExpr(expr string) (skipList []SkipTsUnit, errMsg string)
type SpeedInfo ¶ added in v1.20.0
type SpeedStatus ¶
type SpeedStatus struct { Locker sync.Mutex IsRunning bool // contains filtered or unexported fields }
func (*SpeedStatus) DrawProgressBar ¶
func (this *SpeedStatus) DrawProgressBar(total int, current int)
func (*SpeedStatus) GetPercent ¶
func (this *SpeedStatus) GetPercent() (percent int)
func (*SpeedStatus) GetTitle ¶
func (this *SpeedStatus) GetTitle() (title string)
func (*SpeedStatus) ResetTotalBlockCount ¶ added in v1.20.0
func (this *SpeedStatus) ResetTotalBlockCount(count int)
func (*SpeedStatus) SetProgressBarTitle ¶
func (this *SpeedStatus) SetProgressBarTitle(title string)
func (*SpeedStatus) SpeedAdd1Block ¶ added in v1.20.0
func (this *SpeedStatus) SpeedAdd1Block(byteCount int)
func (*SpeedStatus) SpeedRecent5sGetAndUpdate ¶
func (this *SpeedStatus) SpeedRecent5sGetAndUpdate() (speed SpeedInfo)
func (*SpeedStatus) SpeedResetBytes ¶
func (this *SpeedStatus) SpeedResetBytes()
type StartDownload_Req ¶ added in v1.20.0
type StartDownload_Req struct { M3u8Url string Insecure bool // "是否允许不安全的请求(默认为false)" SaveDir string // "文件保存路径(默认为当前路径)" FileName string // 文件名 SkipTsExpr string // 跳过ts信息,ts编号从1开始,可以以逗号","为分隔符跳过多部分ts,例如: 1,92-100 表示跳过第1号ts、跳过92到100号ts SetProxy string //代理 HeaderMap map[string][]string // 自定义http头信息 SkipRemoveTs bool // 不删除ts文件 ProgressBarShow bool // 在控制台打印进度条 ThreadCount int // 线程数 SkipCacheCheck bool // 不缓存已下载的m3u8的文件信息 SkipMergeTs bool // 不合并ts为mp4 Skip_EXT_X_DISCONTINUITY bool // 跳过 #EXT-X-DISCONTINUITY 标签包裹的ts }
Click to show internal directories.
Click to hide internal directories.