This repository has been archived by the owner on Aug 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
72 lines (65 loc) · 1.79 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"flag"
"strconv"
"time"
"gopkg.in/cheggaaa/pb.v1"
)
type bahamut struct {
sn string
mUrl string
plName string
chuckList []string
bar *pb.ProgressBar
startTime int64
deviceId string
cookie string
rawCookie string
quality string
res string
tmp string
isPremium bool
time string
outputPath string
}
func main() {
envCheck()
handler := &bahamut{
startTime: time.Now().Unix(),
}
flag.StringVar(&handler.sn, "sn", "", "set sn")
flag.StringVar(&handler.sn, "s", "", "set sn(shorthand)")
flag.StringVar(&handler.cookie, "cookie", "", "cookie") // raw cookie
flag.StringVar(&handler.cookie, "c", "", "cookie(shorthand)")
flag.StringVar(&handler.time, "t", "30", "time(shorthand)")
flag.StringVar(&handler.quality, "quality", "720p", "set resolution")
flag.StringVar(&handler.quality, "q", "720p", "set resolution(shorthand)")
flag.StringVar(&handler.outputPath, "o", "output", "Output Path(shorthand)")
flag.Parse()
handler.askForSN()
handler.readCookieFile()
handler.refreshCookie()
handler.getDeviceId()
handler.gainAccess()
handler.checkPremium()
handler.unlock()
handler.checkLock()
handler.unlock()
handler.unlock()
if !handler.isPremium {
handler.startAd()
t, err := strconv.Atoi(handler.time)
isErr("convert the time to integer failed - ", err)
time.Sleep(time.Duration(t) * time.Second)
handler.skipAd()
}
handler.videoStart()
handler.checkNoAd()
handler.getM3U8()
handler.parseMasterList()
handler.downloadM3U8()
handler.parseM3U8()
handler.start()
handler.mergeChunk()
handler.cleanUp()
}