parent
e11a078d74
commit
54b8aff763
|
|
@ -4,3 +4,4 @@
|
|||
/.idea
|
||||
/bin
|
||||
/m3u8d-qt/m3u8d-impl.a
|
||||
/testdata/save_dir
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* 没有ffmpeg依赖, 不需要单独配置任何环境
|
||||
* 提供windows图形界面(Qt), mac、linux命令行, linux支持arm、386、mipsle
|
||||
* 程序会自动将下载的ts文件合并转换格式为mp4
|
||||
* windows自带GUI界面的版本下载: [m3u8d_qt_v1.5.3_windows_amd64.exe](https://github.com/orestonce/m3u8d/releases/download/v1.5.3/m3u8d_qt_v1.5.3_windows_amd64.exe):
|
||||
* windows自带GUI界面的版本下载: [m3u8d_qt_v1.5.4_windows_amd64.exe](https://github.com/orestonce/m3u8d/releases/download/v1.5.4/m3u8d_qt_v1.5.4_windows_amd64.exe):
|
||||

|
||||
* 全部版本下载, 包括windows图形界面/linux命令行/mac命令行: https://github.com/orestonce/m3u8d/releases
|
||||
* linux/mac版的命令行使用教程
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ var gRunReq m3u8d.RunDownload_Req
|
|||
|
||||
func init() {
|
||||
downloadCmd.Flags().StringVarP(&gRunReq.M3u8Url, "M3u8Url", "u", "", "M3u8Url")
|
||||
downloadCmd.Flags().StringVarP(&gRunReq.HostType, "HostType", "", "apiv1", "设置getHost的方式(apiv1: `http(s):// + url.Host + filepath.Dir(url.Path)`; apiv2: `http(s)://+ u.Host`")
|
||||
downloadCmd.Flags().BoolVarP(&gRunReq.Insecure, "Insecure", "", false, "是否允许不安全的请求")
|
||||
downloadCmd.Flags().StringVarP(&gRunReq.SaveDir, "SaveDir", "d", "", "文件保存路径(默认为当前路径)")
|
||||
downloadCmd.Flags().StringVarP(&gRunReq.FileName, "FileName", "f", "", "文件名")
|
||||
|
|
|
|||
82
download.go
82
download.go
|
|
@ -15,7 +15,6 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
|
@ -76,7 +75,6 @@ type RunDownload_Resp struct {
|
|||
|
||||
type RunDownload_Req struct {
|
||||
M3u8Url string
|
||||
HostType string // "设置getHost的方式(apiv1: `http(s):// + url.Host + filepath.Dir(url.Path)`; apiv2: `http(s)://+ u.Host`"
|
||||
Insecure bool // "是否允许不安全的请求(默认为false)"
|
||||
SaveDir string // "文件保存路径(默认为当前路径)"
|
||||
FileName string // 文件名
|
||||
|
|
@ -94,9 +92,6 @@ type downloadEnv struct {
|
|||
}
|
||||
|
||||
func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp) {
|
||||
if req.HostType == "" {
|
||||
req.HostType = "apiv1"
|
||||
}
|
||||
if req.SaveDir == "" {
|
||||
var err error
|
||||
req.SaveDir, err = os.Getwd()
|
||||
|
|
@ -111,7 +106,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
|
|||
if req.SkipTsCountFromHead < 0 {
|
||||
req.SkipTsCountFromHead = 0
|
||||
}
|
||||
host, err := getHost(req.M3u8Url, "apiv2")
|
||||
host, err := getHost(req.M3u8Url)
|
||||
if err != nil {
|
||||
resp.ErrMsg = "getHost0: " + err.Error()
|
||||
return resp
|
||||
|
|
@ -129,9 +124,10 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
|
|||
}
|
||||
SetProgressBarTitle("[1/6]嗅探m3u8")
|
||||
var m3u8Body []byte
|
||||
req.M3u8Url, m3u8Body, err = this.sniffM3u8(req.M3u8Url)
|
||||
if err != nil {
|
||||
resp.ErrMsg = "sniffM3u8: " + err.Error()
|
||||
var errMsg string
|
||||
req.M3u8Url, m3u8Body, errMsg = this.sniffM3u8(req.M3u8Url)
|
||||
if errMsg != "" {
|
||||
resp.ErrMsg = "sniffM3u8: " + errMsg
|
||||
resp.IsCancel = this.GetIsCancel()
|
||||
return resp
|
||||
}
|
||||
|
|
@ -166,23 +162,17 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
|
|||
return resp
|
||||
}
|
||||
}
|
||||
m3u8Host, err := getHost(req.M3u8Url, req.HostType)
|
||||
if err != nil {
|
||||
resp.ErrMsg = "getHost1: " + err.Error()
|
||||
resp.IsCancel = this.GetIsCancel()
|
||||
return resp
|
||||
}
|
||||
// 获取m3u8地址的内容体
|
||||
ts_key, err := this.getM3u8Key(m3u8Host, string(m3u8Body))
|
||||
tsKey, err := this.getM3u8Key(req.M3u8Url, string(m3u8Body))
|
||||
if err != nil {
|
||||
resp.ErrMsg = "getM3u8Key: " + err.Error()
|
||||
resp.IsCancel = this.GetIsCancel()
|
||||
return resp
|
||||
}
|
||||
SetProgressBarTitle("[3/6]获取ts列表")
|
||||
tsList, errMsg := getTsList(m3u8Host, string(m3u8Body))
|
||||
tsList, errMsg := getTsList(req.M3u8Url, string(m3u8Body))
|
||||
if errMsg != "" {
|
||||
resp.ErrMsg = "获取ts列表错误: " + strconv.Quote(m3u8Host)
|
||||
resp.ErrMsg = "获取ts列表错误"
|
||||
return resp
|
||||
}
|
||||
if len(tsList) <= req.SkipTsCountFromHead {
|
||||
|
|
@ -192,7 +182,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
|
|||
tsList = tsList[req.SkipTsCountFromHead:]
|
||||
// 下载ts
|
||||
SetProgressBarTitle("[4/6]下载ts")
|
||||
err = this.downloader(tsList, downloadDir, ts_key)
|
||||
err = this.downloader(tsList, downloadDir, tsKey)
|
||||
if err != nil {
|
||||
resp.ErrMsg = "下载ts文件错误: " + err.Error()
|
||||
resp.IsCancel = this.GetIsCancel()
|
||||
|
|
@ -259,6 +249,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
|
|||
resp.ErrMsg = "删除下载目录失败: " + err.Error()
|
||||
return resp
|
||||
}
|
||||
// 如果downloading目录为空,就删除掉,否则忽略
|
||||
_ = os.Remove(filepath.Join(req.SaveDir, "downloading"))
|
||||
return resp
|
||||
}
|
||||
|
|
@ -303,19 +294,12 @@ func CloseOldEnv() {
|
|||
}
|
||||
|
||||
// 获取m3u8地址的host
|
||||
func getHost(Url, ht string) (host string, err error) {
|
||||
func getHost(Url string) (host string, err error) {
|
||||
u, err := url.Parse(Url)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
switch ht {
|
||||
case "apiv1":
|
||||
return u.Scheme + "://" + u.Host + path.Dir(u.EscapedPath()), nil
|
||||
case "apiv2":
|
||||
return u.Scheme + "://" + u.Host, nil
|
||||
default:
|
||||
return "", errors.New("getHost invalid ht " + strconv.Quote(ht))
|
||||
}
|
||||
}
|
||||
|
||||
func GetWd() string {
|
||||
|
|
@ -324,18 +308,22 @@ func GetWd() string {
|
|||
}
|
||||
|
||||
// 获取m3u8加密的密钥
|
||||
func (this *downloadEnv) getM3u8Key(host, html string) (key string, err error) {
|
||||
func (this *downloadEnv) getM3u8Key(m3u8Url string, html string) (key string, err error) {
|
||||
lines := strings.Split(html, "\n")
|
||||
key = ""
|
||||
for _, line := range lines {
|
||||
if strings.Contains(line, "#EXT-X-KEY") {
|
||||
uri_pos := strings.Index(line, "URI")
|
||||
quotation_mark_pos := strings.LastIndex(line, "\"")
|
||||
key_url := strings.Split(line[uri_pos:quotation_mark_pos], "\"")[1]
|
||||
uriPos := strings.Index(line, "URI")
|
||||
quotationMarkPos := strings.LastIndex(line, "\"")
|
||||
keyUrl := strings.Split(line[uriPos:quotationMarkPos], "\"")[1]
|
||||
if !strings.Contains(line, "http") {
|
||||
key_url = fmt.Sprintf("%s/%s", host, key_url)
|
||||
var errMsg string
|
||||
keyUrl, errMsg = resolveRefUrl(m3u8Url, line)
|
||||
if errMsg != "" {
|
||||
return "", errors.New(errMsg)
|
||||
}
|
||||
res, err := this.doGetRequest(key_url)
|
||||
}
|
||||
res, err := this.doGetRequest(keyUrl)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
@ -345,22 +333,20 @@ func (this *downloadEnv) getM3u8Key(host, html string) (key string, err error) {
|
|||
return "", nil
|
||||
}
|
||||
|
||||
func getTsList(host, body string) (tsList []TsInfo, errMsg string) {
|
||||
func getTsList(m38uUrl string, body string) (tsList []TsInfo, errMsg string) {
|
||||
lines := strings.Split(body, "\n")
|
||||
index := 0
|
||||
|
||||
const TS_NAME_TEMPLATE = "%05d.ts" // ts视频片段命名规则
|
||||
|
||||
for _, line := range lines {
|
||||
if !strings.HasPrefix(line, "#") && line != "" {
|
||||
index++
|
||||
var after string
|
||||
after, errMsg = resolveRefUrl(host, line)
|
||||
after, errMsg = resolveRefUrl(m38uUrl, line)
|
||||
if errMsg != "" {
|
||||
return nil, errMsg
|
||||
}
|
||||
tsList = append(tsList, TsInfo{
|
||||
Name: fmt.Sprintf(TS_NAME_TEMPLATE, index),
|
||||
Name: fmt.Sprintf("%05d.ts", index), // ts视频片段命名规则
|
||||
Url: after,
|
||||
})
|
||||
}
|
||||
|
|
@ -488,7 +474,7 @@ func DrawProgressBar(total int, current int) {
|
|||
if gShowProgressBar {
|
||||
width := 50
|
||||
pos := int(proportion * float32(width))
|
||||
fmt.Printf("["+title+"] %s%*s %6.2f%%\r", strings.Repeat("■", pos), width-pos, "", proportion*100)
|
||||
fmt.Printf(title+" %s%*s %6.2f%%\r", strings.Repeat("■", pos), width-pos, "", proportion*100)
|
||||
}
|
||||
gShowProgressBarLocker.Unlock()
|
||||
}
|
||||
|
|
@ -540,11 +526,12 @@ func getFileSha256(targetFile string) (v string) {
|
|||
return hex.EncodeToString(tmp[:])
|
||||
}
|
||||
|
||||
func (this *downloadEnv) sniffM3u8(urlS string) (afterUrl string, content []byte, err error) {
|
||||
func (this *downloadEnv) sniffM3u8(urlS string) (afterUrl string, content []byte, errMsg string) {
|
||||
for idx := 0; idx < 5; idx++ {
|
||||
var err error
|
||||
content, err = this.doGetRequest(urlS)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
return "", nil, err.Error()
|
||||
}
|
||||
if UrlHasSuffix(urlS, ".m3u8") {
|
||||
// 看这个是不是嵌套的m3u8
|
||||
|
|
@ -566,25 +553,24 @@ func (this *downloadEnv) sniffM3u8(urlS string) (afterUrl string, content []byte
|
|||
}
|
||||
}
|
||||
if containsTs {
|
||||
return urlS, content, err
|
||||
return urlS, content, ""
|
||||
}
|
||||
if m3u8Url == "" {
|
||||
return "", nil, errors.New("未发现m3u8资源_1")
|
||||
return "", nil, "未发现m3u8资源_1"
|
||||
}
|
||||
var errMsg string
|
||||
urlS, errMsg = resolveRefUrl(urlS, m3u8Url)
|
||||
if errMsg != "" {
|
||||
return "", nil, errors.New(errMsg)
|
||||
return "", nil, errMsg
|
||||
}
|
||||
continue
|
||||
}
|
||||
groups := regexp.MustCompile(`http[s]://[a-zA-Z0-9/\\.%_-]+.m3u8`).FindSubmatch(content)
|
||||
if len(groups) == 0 {
|
||||
return "", nil, errors.New("未发现m3u8资源_2")
|
||||
return "", nil, "未发现m3u8资源_2"
|
||||
}
|
||||
urlS = string(groups[0])
|
||||
}
|
||||
return "", nil, errors.New("未发现m3u8资源_3")
|
||||
return "", nil, "未发现m3u8资源_3"
|
||||
}
|
||||
|
||||
func resolveRefUrl(baseUrl string, extUrl string) (after string, errMsg string) {
|
||||
|
|
@ -625,7 +611,7 @@ func (this *downloadEnv) doGetRequest(urlS string) (data []byte, err error) {
|
|||
return nil, err
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
return content, errors.New("resp.Status: " + resp.Status)
|
||||
return content, errors.New("resp.Status: " + resp.Status + " " + urlS)
|
||||
}
|
||||
return content, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
package m3u8d
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -28,22 +34,69 @@ func TestUrlHasSuffix(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetTsList(t *testing.T) {
|
||||
v, err := getHost(`https://example.com:65/3kb/hls/index.m3u8`, `apiv1`)
|
||||
v, err := getHost(`https://example.com:65/3kb/hls/index.m3u8`)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if v != `https://example.com:65/3kb/hls` {
|
||||
if v != `https://example.com:65` {
|
||||
panic(v)
|
||||
}
|
||||
list, errMsg := getTsList(`https://example.com:65/3kb/hls`, `#EXTINF:3.753,
|
||||
/3kb/hls/JJG.ts`)
|
||||
// 相对根目录
|
||||
tGetTsList(`https://example.com:65/3kb/hls/index.m3u8`, `/3kb/hls/JJG.ts`, "https://example.com:65/3kb/hls/JJG.ts")
|
||||
// 相对自己
|
||||
tGetTsList("https://example.xyz/k/data1/SD/index.m3u8", `0.ts`, `https://example.xyz/k/data1/SD/0.ts`)
|
||||
// 绝对路径
|
||||
tGetTsList("https://example.xyz/k/data1/SD/index.m3u8", `https://exampe2.com/0.ts`, `https://exampe2.com/0.ts`)
|
||||
}
|
||||
|
||||
func tGetTsList(m3u8Url string, m3u8Content string, expectTs0Url string) {
|
||||
list, errMsg := getTsList(m3u8Url, m3u8Content)
|
||||
if errMsg != "" {
|
||||
panic(errMsg)
|
||||
}
|
||||
if len(list) != 1 {
|
||||
panic(len(list))
|
||||
}
|
||||
if list[0].Url != "https://example.com:65/3kb/hls/JJG.ts" {
|
||||
if list[0].Url != expectTs0Url {
|
||||
panic(list[0].Url)
|
||||
}
|
||||
}
|
||||
|
||||
//go:embed testdata/TestFull
|
||||
var sDataTestFull embed.FS
|
||||
|
||||
func TestFull(t *testing.T) {
|
||||
subFs, err := fs.Sub(sDataTestFull, "testdata/TestFull")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/", http.FileServer(http.FS(subFs)))
|
||||
server := httptest.NewServer(mux)
|
||||
m3u8Url := server.URL + "/jhxy.01.m3u8"
|
||||
resp, err := http.Get(m3u8Url)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
resp.Body.Close()
|
||||
if resp.StatusCode != 200 {
|
||||
panic(resp.Status + " " + m3u8Url)
|
||||
}
|
||||
saveDir := filepath.Join(GetWd(), "testdata/save_dir")
|
||||
err = os.RemoveAll(saveDir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
resp2 := RunDownload(RunDownload_Req{
|
||||
M3u8Url: m3u8Url,
|
||||
SaveDir: saveDir,
|
||||
FileName: "all",
|
||||
})
|
||||
if resp2.ErrMsg != "" {
|
||||
panic(resp2.ErrMsg)
|
||||
}
|
||||
fState, err := os.Stat(filepath.Join(saveDir, "all.mp4"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if fState.Size() <= 100*1000 { // 100KB
|
||||
panic("state error")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
const version = "1.5.3"
|
||||
const version = "1.5.4"
|
||||
|
||||
func main() {
|
||||
BuildCliBinary() // 编译二进制
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -7,7 +7,7 @@ require (
|
|||
github.com/orestonce/go2cpp v0.0.0-20220704224208-2d58769247a4
|
||||
github.com/orestonce/gopool v0.0.0-20220508090328-d7d56d45b171
|
||||
github.com/spf13/cobra v1.4.0
|
||||
github.com/yapingcat/gomedia v0.0.0-20220623101430-02bb90c39484
|
||||
github.com/yapingcat/gomedia v0.0.0-20220717141418-916ca463aae9
|
||||
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9
|
||||
golang.org/x/text v0.3.7
|
||||
)
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -12,8 +12,8 @@ github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
|
|||
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/yapingcat/gomedia v0.0.0-20220623101430-02bb90c39484 h1:RP29R6ZQHo/wEgTIU/9x70uAdeXNMPiuSX1/I5M6dug=
|
||||
github.com/yapingcat/gomedia v0.0.0-20220623101430-02bb90c39484/go.mod h1:WSZ59bidJOO40JSJmLqlkBJrjZCtjbKKkygEMfzY/kc=
|
||||
github.com/yapingcat/gomedia v0.0.0-20220717141418-916ca463aae9 h1:iIeMJO+oyppY4ggENbLREBYro32NnTp5mgMEZRqpXNs=
|
||||
github.com/yapingcat/gomedia v0.0.0-20220717141418-916ca463aae9/go.mod h1:WSZ59bidJOO40JSJmLqlkBJrjZCtjbKKkygEMfzY/kc=
|
||||
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9 h1:Yqz/iviulwKwAREEeUd3nbBFn0XuyJqkoft2IlrvOhc=
|
||||
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
|
|
|||
|
|
@ -85,101 +85,91 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){
|
|||
std::string in;
|
||||
{
|
||||
{
|
||||
uint32_t tmp36 = in0.M3u8Url.length();
|
||||
char tmp37[4];
|
||||
tmp37[0] = (uint32_t(tmp36) >> 24) & 0xFF;
|
||||
tmp37[1] = (uint32_t(tmp36) >> 16) & 0xFF;
|
||||
tmp37[2] = (uint32_t(tmp36) >> 8) & 0xFF;
|
||||
tmp37[3] = (uint32_t(tmp36) >> 0) & 0xFF;
|
||||
in.append(tmp37, 4);
|
||||
uint32_t tmp33 = in0.M3u8Url.length();
|
||||
char tmp34[4];
|
||||
tmp34[0] = (uint32_t(tmp33) >> 24) & 0xFF;
|
||||
tmp34[1] = (uint32_t(tmp33) >> 16) & 0xFF;
|
||||
tmp34[2] = (uint32_t(tmp33) >> 8) & 0xFF;
|
||||
tmp34[3] = (uint32_t(tmp33) >> 0) & 0xFF;
|
||||
in.append(tmp34, 4);
|
||||
in.append(in0.M3u8Url);
|
||||
}
|
||||
{
|
||||
uint32_t tmp38 = in0.HostType.length();
|
||||
char tmp39[4];
|
||||
tmp39[0] = (uint32_t(tmp38) >> 24) & 0xFF;
|
||||
tmp39[1] = (uint32_t(tmp38) >> 16) & 0xFF;
|
||||
tmp39[2] = (uint32_t(tmp38) >> 8) & 0xFF;
|
||||
tmp39[3] = (uint32_t(tmp38) >> 0) & 0xFF;
|
||||
in.append(tmp39, 4);
|
||||
in.append(in0.HostType);
|
||||
}
|
||||
in.append((char*)(&in0.Insecure), 1);
|
||||
{
|
||||
uint32_t tmp40 = in0.SaveDir.length();
|
||||
uint32_t tmp35 = in0.SaveDir.length();
|
||||
char tmp36[4];
|
||||
tmp36[0] = (uint32_t(tmp35) >> 24) & 0xFF;
|
||||
tmp36[1] = (uint32_t(tmp35) >> 16) & 0xFF;
|
||||
tmp36[2] = (uint32_t(tmp35) >> 8) & 0xFF;
|
||||
tmp36[3] = (uint32_t(tmp35) >> 0) & 0xFF;
|
||||
in.append(tmp36, 4);
|
||||
in.append(in0.SaveDir);
|
||||
}
|
||||
{
|
||||
uint32_t tmp37 = in0.FileName.length();
|
||||
char tmp38[4];
|
||||
tmp38[0] = (uint32_t(tmp37) >> 24) & 0xFF;
|
||||
tmp38[1] = (uint32_t(tmp37) >> 16) & 0xFF;
|
||||
tmp38[2] = (uint32_t(tmp37) >> 8) & 0xFF;
|
||||
tmp38[3] = (uint32_t(tmp37) >> 0) & 0xFF;
|
||||
in.append(tmp38, 4);
|
||||
in.append(in0.FileName);
|
||||
}
|
||||
{
|
||||
char tmp39[4];
|
||||
tmp39[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
|
||||
tmp39[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
|
||||
tmp39[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
|
||||
tmp39[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
|
||||
in.append(tmp39, 4);
|
||||
}
|
||||
{
|
||||
uint32_t tmp40 = in0.SetProxy.length();
|
||||
char tmp41[4];
|
||||
tmp41[0] = (uint32_t(tmp40) >> 24) & 0xFF;
|
||||
tmp41[1] = (uint32_t(tmp40) >> 16) & 0xFF;
|
||||
tmp41[2] = (uint32_t(tmp40) >> 8) & 0xFF;
|
||||
tmp41[3] = (uint32_t(tmp40) >> 0) & 0xFF;
|
||||
in.append(tmp41, 4);
|
||||
in.append(in0.SaveDir);
|
||||
in.append(in0.SetProxy);
|
||||
}
|
||||
{
|
||||
uint32_t tmp42 = in0.FileName.length();
|
||||
uint32_t tmp42 = in0.HeaderMap.size();
|
||||
char tmp43[4];
|
||||
tmp43[0] = (uint32_t(tmp42) >> 24) & 0xFF;
|
||||
tmp43[1] = (uint32_t(tmp42) >> 16) & 0xFF;
|
||||
tmp43[2] = (uint32_t(tmp42) >> 8) & 0xFF;
|
||||
tmp43[3] = (uint32_t(tmp42) >> 0) & 0xFF;
|
||||
in.append(tmp43, 4);
|
||||
in.append(in0.FileName);
|
||||
}
|
||||
for(std::map<std::string, std::vector<std::string>>::iterator tmp44 = in0.HeaderMap.begin(); tmp44 != in0.HeaderMap.end(); ++tmp44) {
|
||||
{
|
||||
char tmp44[4];
|
||||
tmp44[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
|
||||
tmp44[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
|
||||
tmp44[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
|
||||
tmp44[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
|
||||
in.append(tmp44, 4);
|
||||
}
|
||||
{
|
||||
uint32_t tmp45 = in0.SetProxy.length();
|
||||
uint32_t tmp45 = tmp44->first.length();
|
||||
char tmp46[4];
|
||||
tmp46[0] = (uint32_t(tmp45) >> 24) & 0xFF;
|
||||
tmp46[1] = (uint32_t(tmp45) >> 16) & 0xFF;
|
||||
tmp46[2] = (uint32_t(tmp45) >> 8) & 0xFF;
|
||||
tmp46[3] = (uint32_t(tmp45) >> 0) & 0xFF;
|
||||
in.append(tmp46, 4);
|
||||
in.append(in0.SetProxy);
|
||||
in.append(tmp44->first);
|
||||
}
|
||||
{
|
||||
uint32_t tmp47 = in0.HeaderMap.size();
|
||||
uint32_t tmp47 = tmp44->second.size();
|
||||
char tmp48[4];
|
||||
tmp48[0] = (uint32_t(tmp47) >> 24) & 0xFF;
|
||||
tmp48[1] = (uint32_t(tmp47) >> 16) & 0xFF;
|
||||
tmp48[2] = (uint32_t(tmp47) >> 8) & 0xFF;
|
||||
tmp48[3] = (uint32_t(tmp47) >> 0) & 0xFF;
|
||||
in.append(tmp48, 4);
|
||||
for(std::map<std::string, std::vector<std::string>>::iterator tmp49 = in0.HeaderMap.begin(); tmp49 != in0.HeaderMap.end(); ++tmp49) {
|
||||
for (uint32_t tmp49=0; tmp49 < tmp47; ++tmp49) {
|
||||
{
|
||||
uint32_t tmp50 = tmp49->first.length();
|
||||
uint32_t tmp50 = tmp44->second[tmp49].length();
|
||||
char tmp51[4];
|
||||
tmp51[0] = (uint32_t(tmp50) >> 24) & 0xFF;
|
||||
tmp51[1] = (uint32_t(tmp50) >> 16) & 0xFF;
|
||||
tmp51[2] = (uint32_t(tmp50) >> 8) & 0xFF;
|
||||
tmp51[3] = (uint32_t(tmp50) >> 0) & 0xFF;
|
||||
in.append(tmp51, 4);
|
||||
in.append(tmp49->first);
|
||||
}
|
||||
{
|
||||
uint32_t tmp52 = tmp49->second.size();
|
||||
char tmp53[4];
|
||||
tmp53[0] = (uint32_t(tmp52) >> 24) & 0xFF;
|
||||
tmp53[1] = (uint32_t(tmp52) >> 16) & 0xFF;
|
||||
tmp53[2] = (uint32_t(tmp52) >> 8) & 0xFF;
|
||||
tmp53[3] = (uint32_t(tmp52) >> 0) & 0xFF;
|
||||
in.append(tmp53, 4);
|
||||
for (uint32_t tmp54=0; tmp54 < tmp52; ++tmp54) {
|
||||
{
|
||||
uint32_t tmp55 = tmp49->second[tmp54].length();
|
||||
char tmp56[4];
|
||||
tmp56[0] = (uint32_t(tmp55) >> 24) & 0xFF;
|
||||
tmp56[1] = (uint32_t(tmp55) >> 16) & 0xFF;
|
||||
tmp56[2] = (uint32_t(tmp55) >> 8) & 0xFF;
|
||||
tmp56[3] = (uint32_t(tmp55) >> 0) & 0xFF;
|
||||
in.append(tmp56, 4);
|
||||
in.append(tmp49->second[tmp54]);
|
||||
in.append(tmp44->second[tmp49]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -192,6 +182,21 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){
|
|||
RunDownload_Resp retValue;
|
||||
int outIdx = 0;
|
||||
{
|
||||
{
|
||||
uint32_t tmp52 = 0;
|
||||
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp52 = tmp53 | tmp54 | tmp55 | tmp56;
|
||||
outIdx+=4;
|
||||
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp52);
|
||||
outIdx+=tmp52;
|
||||
}
|
||||
retValue.IsSkipped = (bool) out[outIdx];
|
||||
outIdx++;
|
||||
retValue.IsCancel = (bool) out[outIdx];
|
||||
outIdx++;
|
||||
{
|
||||
uint32_t tmp57 = 0;
|
||||
uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
|
|
@ -200,24 +205,9 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){
|
|||
uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp57 = tmp58 | tmp59 | tmp60 | tmp61;
|
||||
outIdx+=4;
|
||||
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp57);
|
||||
retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp57);
|
||||
outIdx+=tmp57;
|
||||
}
|
||||
retValue.IsSkipped = (bool) out[outIdx];
|
||||
outIdx++;
|
||||
retValue.IsCancel = (bool) out[outIdx];
|
||||
outIdx++;
|
||||
{
|
||||
uint32_t tmp62 = 0;
|
||||
uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp64 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp65 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp62 = tmp63 | tmp64 | tmp65 | tmp66;
|
||||
outIdx+=4;
|
||||
retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp62);
|
||||
outIdx+=tmp62;
|
||||
}
|
||||
}
|
||||
if (out != NULL) {
|
||||
free(out);
|
||||
|
|
@ -307,13 +297,13 @@ std::string GetWd(){
|
|||
ParseCurl_Resp ParseCurlStr(std::string in0){
|
||||
std::string in;
|
||||
{
|
||||
uint32_t tmp19 = in0.length();
|
||||
char tmp20[4];
|
||||
tmp20[0] = (uint32_t(tmp19) >> 24) & 0xFF;
|
||||
tmp20[1] = (uint32_t(tmp19) >> 16) & 0xFF;
|
||||
tmp20[2] = (uint32_t(tmp19) >> 8) & 0xFF;
|
||||
tmp20[3] = (uint32_t(tmp19) >> 0) & 0xFF;
|
||||
in.append(tmp20, 4);
|
||||
uint32_t tmp18 = in0.length();
|
||||
char tmp19[4];
|
||||
tmp19[0] = (uint32_t(tmp18) >> 24) & 0xFF;
|
||||
tmp19[1] = (uint32_t(tmp18) >> 16) & 0xFF;
|
||||
tmp19[2] = (uint32_t(tmp18) >> 8) & 0xFF;
|
||||
tmp19[3] = (uint32_t(tmp18) >> 0) & 0xFF;
|
||||
in.append(tmp19, 4);
|
||||
in.append(in0);
|
||||
}
|
||||
char *out = NULL;
|
||||
|
|
@ -323,92 +313,93 @@ ParseCurl_Resp ParseCurlStr(std::string in0){
|
|||
int outIdx = 0;
|
||||
{
|
||||
{
|
||||
uint32_t tmp21 = 0;
|
||||
uint32_t tmp22 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp23 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp25 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp21 = tmp22 | tmp23 | tmp24 | tmp25;
|
||||
uint32_t tmp20 = 0;
|
||||
uint32_t tmp21 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp22 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp23 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp20 = tmp21 | tmp22 | tmp23 | tmp24;
|
||||
outIdx+=4;
|
||||
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp21);
|
||||
outIdx+=tmp21;
|
||||
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp20);
|
||||
outIdx+=tmp20;
|
||||
}
|
||||
{
|
||||
{
|
||||
uint32_t tmp26 = 0;
|
||||
uint32_t tmp27 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp28 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp30 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp26 = tmp27 | tmp28 | tmp29 | tmp30;
|
||||
uint32_t tmp25 = 0;
|
||||
uint32_t tmp26 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp27 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp28 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp25 = tmp26 | tmp27 | tmp28 | tmp29;
|
||||
outIdx+=4;
|
||||
retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp26);
|
||||
outIdx+=tmp26;
|
||||
}
|
||||
{
|
||||
uint32_t tmp31 = 0;
|
||||
uint32_t tmp32 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp33 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp35 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp31 = tmp32 | tmp33 | tmp34 | tmp35;
|
||||
outIdx+=4;
|
||||
retValue.DownloadReq.HostType = std::string(out+outIdx, out+outIdx+tmp31);
|
||||
outIdx+=tmp31;
|
||||
retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp25);
|
||||
outIdx+=tmp25;
|
||||
}
|
||||
retValue.DownloadReq.Insecure = (bool) out[outIdx];
|
||||
outIdx++;
|
||||
{
|
||||
uint32_t tmp36 = 0;
|
||||
uint32_t tmp37 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp38 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp36 = tmp37 | tmp38 | tmp39 | tmp40;
|
||||
uint32_t tmp30 = 0;
|
||||
uint32_t tmp31 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp32 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp33 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp30 = tmp31 | tmp32 | tmp33 | tmp34;
|
||||
outIdx+=4;
|
||||
retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp36);
|
||||
outIdx+=tmp36;
|
||||
retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp30);
|
||||
outIdx+=tmp30;
|
||||
}
|
||||
{
|
||||
uint32_t tmp41 = 0;
|
||||
uint32_t tmp42 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp44 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp45 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp41 = tmp42 | tmp43 | tmp44 | tmp45;
|
||||
uint32_t tmp35 = 0;
|
||||
uint32_t tmp36 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp37 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp38 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp35 = tmp36 | tmp37 | tmp38 | tmp39;
|
||||
outIdx+=4;
|
||||
retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp41);
|
||||
outIdx+=tmp41;
|
||||
retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp35);
|
||||
outIdx+=tmp35;
|
||||
}
|
||||
{
|
||||
uint32_t tmp46 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp47 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp49 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
retValue.DownloadReq.SkipTsCountFromHead = tmp46 | tmp47 | tmp48 | tmp49;
|
||||
uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp41 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp42 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
retValue.DownloadReq.SkipTsCountFromHead = tmp40 | tmp41 | tmp42 | tmp43;
|
||||
outIdx+=4;
|
||||
}
|
||||
{
|
||||
uint32_t tmp50 = 0;
|
||||
uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp50 = tmp51 | tmp52 | tmp53 | tmp54;
|
||||
uint32_t tmp44 = 0;
|
||||
uint32_t tmp45 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp46 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp47 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp44 = tmp45 | tmp46 | tmp47 | tmp48;
|
||||
outIdx+=4;
|
||||
retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp50);
|
||||
outIdx+=tmp50;
|
||||
retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp44);
|
||||
outIdx+=tmp44;
|
||||
}
|
||||
{
|
||||
uint32_t tmp55 = 0;
|
||||
uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp55 = tmp56 | tmp57 | tmp58 | tmp59;
|
||||
uint32_t tmp49 = 0;
|
||||
uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp49 = tmp50 | tmp51 | tmp52 | tmp53;
|
||||
outIdx+=4;
|
||||
for (uint32_t tmp60 = 0; tmp60 < tmp55; tmp60++) {
|
||||
std::string tmp61;
|
||||
for (uint32_t tmp54 = 0; tmp54 < tmp49; tmp54++) {
|
||||
std::string tmp55;
|
||||
{
|
||||
uint32_t tmp56 = 0;
|
||||
uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp56 = tmp57 | tmp58 | tmp59 | tmp60;
|
||||
outIdx+=4;
|
||||
tmp55 = std::string(out+outIdx, out+outIdx+tmp56);
|
||||
outIdx+=tmp56;
|
||||
}
|
||||
std::vector<std::string> tmp61;
|
||||
{
|
||||
uint32_t tmp62 = 0;
|
||||
uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
|
|
@ -417,35 +408,23 @@ ParseCurl_Resp ParseCurlStr(std::string in0){
|
|||
uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp62 = tmp63 | tmp64 | tmp65 | tmp66;
|
||||
outIdx+=4;
|
||||
tmp61 = std::string(out+outIdx, out+outIdx+tmp62);
|
||||
outIdx+=tmp62;
|
||||
}
|
||||
std::vector<std::string> tmp67;
|
||||
for (uint32_t tmp67 = 0; tmp67 < tmp62; tmp67++) {
|
||||
std::string tmp68;
|
||||
{
|
||||
uint32_t tmp68 = 0;
|
||||
uint32_t tmp69 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp70 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp71 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp72 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp68 = tmp69 | tmp70 | tmp71 | tmp72;
|
||||
uint32_t tmp69 = 0;
|
||||
uint32_t tmp70 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp71 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp72 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp73 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp69 = tmp70 | tmp71 | tmp72 | tmp73;
|
||||
outIdx+=4;
|
||||
for (uint32_t tmp73 = 0; tmp73 < tmp68; tmp73++) {
|
||||
std::string tmp74;
|
||||
{
|
||||
uint32_t tmp75 = 0;
|
||||
uint32_t tmp76 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp77 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp78 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp79 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp75 = tmp76 | tmp77 | tmp78 | tmp79;
|
||||
outIdx+=4;
|
||||
tmp74 = std::string(out+outIdx, out+outIdx+tmp75);
|
||||
outIdx+=tmp75;
|
||||
tmp68 = std::string(out+outIdx, out+outIdx+tmp69);
|
||||
outIdx+=tmp69;
|
||||
}
|
||||
tmp67.push_back(tmp74);
|
||||
tmp61.push_back(tmp68);
|
||||
}
|
||||
}
|
||||
retValue.DownloadReq.HeaderMap[tmp61] = tmp67;
|
||||
retValue.DownloadReq.HeaderMap[tmp55] = tmp61;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -460,101 +439,91 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){
|
|||
std::string in;
|
||||
{
|
||||
{
|
||||
uint32_t tmp33 = in0.M3u8Url.length();
|
||||
char tmp34[4];
|
||||
tmp34[0] = (uint32_t(tmp33) >> 24) & 0xFF;
|
||||
tmp34[1] = (uint32_t(tmp33) >> 16) & 0xFF;
|
||||
tmp34[2] = (uint32_t(tmp33) >> 8) & 0xFF;
|
||||
tmp34[3] = (uint32_t(tmp33) >> 0) & 0xFF;
|
||||
in.append(tmp34, 4);
|
||||
uint32_t tmp30 = in0.M3u8Url.length();
|
||||
char tmp31[4];
|
||||
tmp31[0] = (uint32_t(tmp30) >> 24) & 0xFF;
|
||||
tmp31[1] = (uint32_t(tmp30) >> 16) & 0xFF;
|
||||
tmp31[2] = (uint32_t(tmp30) >> 8) & 0xFF;
|
||||
tmp31[3] = (uint32_t(tmp30) >> 0) & 0xFF;
|
||||
in.append(tmp31, 4);
|
||||
in.append(in0.M3u8Url);
|
||||
}
|
||||
{
|
||||
uint32_t tmp35 = in0.HostType.length();
|
||||
char tmp36[4];
|
||||
tmp36[0] = (uint32_t(tmp35) >> 24) & 0xFF;
|
||||
tmp36[1] = (uint32_t(tmp35) >> 16) & 0xFF;
|
||||
tmp36[2] = (uint32_t(tmp35) >> 8) & 0xFF;
|
||||
tmp36[3] = (uint32_t(tmp35) >> 0) & 0xFF;
|
||||
in.append(tmp36, 4);
|
||||
in.append(in0.HostType);
|
||||
}
|
||||
in.append((char*)(&in0.Insecure), 1);
|
||||
{
|
||||
uint32_t tmp37 = in0.SaveDir.length();
|
||||
uint32_t tmp32 = in0.SaveDir.length();
|
||||
char tmp33[4];
|
||||
tmp33[0] = (uint32_t(tmp32) >> 24) & 0xFF;
|
||||
tmp33[1] = (uint32_t(tmp32) >> 16) & 0xFF;
|
||||
tmp33[2] = (uint32_t(tmp32) >> 8) & 0xFF;
|
||||
tmp33[3] = (uint32_t(tmp32) >> 0) & 0xFF;
|
||||
in.append(tmp33, 4);
|
||||
in.append(in0.SaveDir);
|
||||
}
|
||||
{
|
||||
uint32_t tmp34 = in0.FileName.length();
|
||||
char tmp35[4];
|
||||
tmp35[0] = (uint32_t(tmp34) >> 24) & 0xFF;
|
||||
tmp35[1] = (uint32_t(tmp34) >> 16) & 0xFF;
|
||||
tmp35[2] = (uint32_t(tmp34) >> 8) & 0xFF;
|
||||
tmp35[3] = (uint32_t(tmp34) >> 0) & 0xFF;
|
||||
in.append(tmp35, 4);
|
||||
in.append(in0.FileName);
|
||||
}
|
||||
{
|
||||
char tmp36[4];
|
||||
tmp36[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
|
||||
tmp36[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
|
||||
tmp36[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
|
||||
tmp36[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
|
||||
in.append(tmp36, 4);
|
||||
}
|
||||
{
|
||||
uint32_t tmp37 = in0.SetProxy.length();
|
||||
char tmp38[4];
|
||||
tmp38[0] = (uint32_t(tmp37) >> 24) & 0xFF;
|
||||
tmp38[1] = (uint32_t(tmp37) >> 16) & 0xFF;
|
||||
tmp38[2] = (uint32_t(tmp37) >> 8) & 0xFF;
|
||||
tmp38[3] = (uint32_t(tmp37) >> 0) & 0xFF;
|
||||
in.append(tmp38, 4);
|
||||
in.append(in0.SaveDir);
|
||||
in.append(in0.SetProxy);
|
||||
}
|
||||
{
|
||||
uint32_t tmp39 = in0.FileName.length();
|
||||
uint32_t tmp39 = in0.HeaderMap.size();
|
||||
char tmp40[4];
|
||||
tmp40[0] = (uint32_t(tmp39) >> 24) & 0xFF;
|
||||
tmp40[1] = (uint32_t(tmp39) >> 16) & 0xFF;
|
||||
tmp40[2] = (uint32_t(tmp39) >> 8) & 0xFF;
|
||||
tmp40[3] = (uint32_t(tmp39) >> 0) & 0xFF;
|
||||
in.append(tmp40, 4);
|
||||
in.append(in0.FileName);
|
||||
}
|
||||
for(std::map<std::string, std::vector<std::string>>::iterator tmp41 = in0.HeaderMap.begin(); tmp41 != in0.HeaderMap.end(); ++tmp41) {
|
||||
{
|
||||
char tmp41[4];
|
||||
tmp41[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
|
||||
tmp41[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
|
||||
tmp41[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
|
||||
tmp41[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
|
||||
in.append(tmp41, 4);
|
||||
}
|
||||
{
|
||||
uint32_t tmp42 = in0.SetProxy.length();
|
||||
uint32_t tmp42 = tmp41->first.length();
|
||||
char tmp43[4];
|
||||
tmp43[0] = (uint32_t(tmp42) >> 24) & 0xFF;
|
||||
tmp43[1] = (uint32_t(tmp42) >> 16) & 0xFF;
|
||||
tmp43[2] = (uint32_t(tmp42) >> 8) & 0xFF;
|
||||
tmp43[3] = (uint32_t(tmp42) >> 0) & 0xFF;
|
||||
in.append(tmp43, 4);
|
||||
in.append(in0.SetProxy);
|
||||
in.append(tmp41->first);
|
||||
}
|
||||
{
|
||||
uint32_t tmp44 = in0.HeaderMap.size();
|
||||
uint32_t tmp44 = tmp41->second.size();
|
||||
char tmp45[4];
|
||||
tmp45[0] = (uint32_t(tmp44) >> 24) & 0xFF;
|
||||
tmp45[1] = (uint32_t(tmp44) >> 16) & 0xFF;
|
||||
tmp45[2] = (uint32_t(tmp44) >> 8) & 0xFF;
|
||||
tmp45[3] = (uint32_t(tmp44) >> 0) & 0xFF;
|
||||
in.append(tmp45, 4);
|
||||
for(std::map<std::string, std::vector<std::string>>::iterator tmp46 = in0.HeaderMap.begin(); tmp46 != in0.HeaderMap.end(); ++tmp46) {
|
||||
for (uint32_t tmp46=0; tmp46 < tmp44; ++tmp46) {
|
||||
{
|
||||
uint32_t tmp47 = tmp46->first.length();
|
||||
uint32_t tmp47 = tmp41->second[tmp46].length();
|
||||
char tmp48[4];
|
||||
tmp48[0] = (uint32_t(tmp47) >> 24) & 0xFF;
|
||||
tmp48[1] = (uint32_t(tmp47) >> 16) & 0xFF;
|
||||
tmp48[2] = (uint32_t(tmp47) >> 8) & 0xFF;
|
||||
tmp48[3] = (uint32_t(tmp47) >> 0) & 0xFF;
|
||||
in.append(tmp48, 4);
|
||||
in.append(tmp46->first);
|
||||
}
|
||||
{
|
||||
uint32_t tmp49 = tmp46->second.size();
|
||||
char tmp50[4];
|
||||
tmp50[0] = (uint32_t(tmp49) >> 24) & 0xFF;
|
||||
tmp50[1] = (uint32_t(tmp49) >> 16) & 0xFF;
|
||||
tmp50[2] = (uint32_t(tmp49) >> 8) & 0xFF;
|
||||
tmp50[3] = (uint32_t(tmp49) >> 0) & 0xFF;
|
||||
in.append(tmp50, 4);
|
||||
for (uint32_t tmp51=0; tmp51 < tmp49; ++tmp51) {
|
||||
{
|
||||
uint32_t tmp52 = tmp46->second[tmp51].length();
|
||||
char tmp53[4];
|
||||
tmp53[0] = (uint32_t(tmp52) >> 24) & 0xFF;
|
||||
tmp53[1] = (uint32_t(tmp52) >> 16) & 0xFF;
|
||||
tmp53[2] = (uint32_t(tmp52) >> 8) & 0xFF;
|
||||
tmp53[3] = (uint32_t(tmp52) >> 0) & 0xFF;
|
||||
in.append(tmp53, 4);
|
||||
in.append(tmp46->second[tmp51]);
|
||||
in.append(tmp41->second[tmp46]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -567,15 +536,15 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){
|
|||
std::string retValue;
|
||||
int outIdx = 0;
|
||||
{
|
||||
uint32_t tmp54 = 0;
|
||||
uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp54 = tmp55 | tmp56 | tmp57 | tmp58;
|
||||
uint32_t tmp49 = 0;
|
||||
uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+0]) << 24);
|
||||
uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+1]) << 16);
|
||||
uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+2]) << 8);
|
||||
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+3]) << 0);
|
||||
tmp49 = tmp50 | tmp51 | tmp52 | tmp53;
|
||||
outIdx+=4;
|
||||
retValue = std::string(out+outIdx, out+outIdx+tmp54);
|
||||
outIdx+=tmp54;
|
||||
retValue = std::string(out+outIdx, out+outIdx+tmp49);
|
||||
outIdx+=tmp49;
|
||||
}
|
||||
if (out != NULL) {
|
||||
free(out);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
struct RunDownload_Req{
|
||||
std::string M3u8Url;
|
||||
std::string HostType;
|
||||
bool Insecure;
|
||||
std::string SaveDir;
|
||||
std::string FileName;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "m3u8d.h"
|
||||
#include <atomic>
|
||||
#include <QFileDialog>
|
||||
#include <QIntValidator>
|
||||
#include "curldialog.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
|
|
@ -50,7 +51,6 @@ void MainWindow::on_pushButton_RunDownload_clicked()
|
|||
ui->pushButton_SaveDir->setEnabled(false);
|
||||
ui->lineEdit_FileName->setEnabled(false);
|
||||
ui->lineEdit_SkipTsCountFromHead->setEnabled(false);
|
||||
ui->comboBox_HostType->setEnabled(false);
|
||||
ui->pushButton_RunDownload->setEnabled(false);
|
||||
ui->checkBox_Insecure->setEnabled(false);
|
||||
ui->progressBar->setValue(0);
|
||||
|
|
@ -60,7 +60,6 @@ void MainWindow::on_pushButton_RunDownload_clicked()
|
|||
|
||||
RunDownload_Req req;
|
||||
req.M3u8Url = ui->lineEdit_M3u8Url->text().toStdString();
|
||||
req.HostType = ui->comboBox_HostType->currentText().toStdString();
|
||||
req.Insecure = ui->checkBox_Insecure->isChecked();
|
||||
req.SaveDir = ui->lineEdit_SaveDir->text().toStdString();
|
||||
req.FileName = ui->lineEdit_FileName->text().toStdString();
|
||||
|
|
@ -76,7 +75,6 @@ void MainWindow::on_pushButton_RunDownload_clicked()
|
|||
ui->pushButton_SaveDir->setEnabled(true);
|
||||
ui->lineEdit_FileName->setEnabled(true);
|
||||
ui->lineEdit_SkipTsCountFromHead->setEnabled(true);
|
||||
ui->comboBox_HostType->setEnabled(true);
|
||||
ui->pushButton_RunDownload->setEnabled(true);
|
||||
ui->checkBox_Insecure->setEnabled(true);
|
||||
ui->pushButton_RunDownload->setText("开始下载");
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>802</width>
|
||||
<width>800</width>
|
||||
<height>260</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -17,27 +17,10 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>代理设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>跳过前面几个TS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_SaveDir"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>保存的文件名</string>
|
||||
<string>m3u8的url</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -48,8 +31,12 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_SkipTsCountFromHead"/>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton_curlMode">
|
||||
<property name="text">
|
||||
<string>curl模式</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
|
|
@ -58,12 +45,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_FileName">
|
||||
<property name="placeholderText">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_SaveDir"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_SaveDir">
|
||||
|
|
@ -90,31 +73,34 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>m3u8的url</string>
|
||||
<string>保存的文件名</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBox_HostType">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>apiv1</string>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_FileName">
|
||||
<property name="placeholderText">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>apiv2</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>HostType</string>
|
||||
<string>跳过前面几个TS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_SkipTsCountFromHead"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>代理设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -128,13 +114,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton_curlMode">
|
||||
<property name="text">
|
||||
<string>curl模式</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ IDI_ICON1 ICON "favicon.ico"
|
|||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,5,3,0
|
||||
PRODUCTVERSION 1,5,3,0
|
||||
FILEVERSION 1,5,4,0
|
||||
PRODUCTVERSION 1,5,4,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
|
|
@ -23,7 +23,7 @@ VS_VERSION_INFO VERSIONINFO
|
|||
BEGIN
|
||||
BLOCK "080404b0"
|
||||
BEGIN
|
||||
VALUE "ProductVersion", "1.5.3.0\0"
|
||||
VALUE "ProductVersion", "1.5.4.0\0"
|
||||
VALUE "ProductName", "m3u8视频下载工具\0"
|
||||
VALUE "LegalCopyright", "https://github.com/orestonce/m3u8d\0"
|
||||
VALUE "FileDescription", "m3u8视频下载工具\0"
|
||||
|
|
|
|||
2
merge.go
2
merge.go
|
|
@ -29,7 +29,7 @@ func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
|
|||
return err
|
||||
}
|
||||
vtid := muxer.AddVideoTrack(mp4.MP4_CODEC_H264)
|
||||
atid := muxer.AddAudioTrack(mp4.MP4_CODEC_AAC, 0, 16, 44100)
|
||||
atid := muxer.AddAudioTrack(mp4.MP4_CODEC_AAC)
|
||||
|
||||
demuxer := mpeg2.NewTSDemuxer()
|
||||
var OnFrameErr error
|
||||
|
|
|
|||
Loading…
Reference in New Issue