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