mirror of
https://github.com/chris124567/hulu
synced 2024-11-23 08:37:29 +00:00
allow specifying KEY_FILE and CLIENT_ID_FILE environment variables
This commit is contained in:
parent
77b6b192bc
commit
bc3ab4bbcb
13
main.go
13
main.go
@ -67,6 +67,9 @@ download [id] - prints the MPD url the video is available at and returns the mp4
|
||||
return
|
||||
}
|
||||
|
||||
key, _ := os.ReadFile(os.Getenv("KEY_FILE"))
|
||||
clientID, _ := os.ReadFile(os.Getenv("CLIENT_ID_FILE"))
|
||||
|
||||
client := hulu.NewDefaultClient(huluSession, huluGUID)
|
||||
w := tabwriter.NewWriter(os.Stdout, 8, 8, 0, '\t', 0)
|
||||
defer w.Flush()
|
||||
@ -138,10 +141,16 @@ download [id] - prints the MPD url the video is available at and returns the mp4
|
||||
panic(err)
|
||||
}
|
||||
|
||||
cdm, err := widevine.NewDefaultCDM(initData)
|
||||
if err != nil {
|
||||
var cdm widevine.CDM
|
||||
if len(key) > 0 && len(clientID) > 0 {
|
||||
if cdm, err = widevine.NewCDM(key, clientID, initData); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
if cdm, err = widevine.NewDefaultCDM(initData); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
licenseRequest, err := cdm.GetLicenseRequest()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user