mirror of
https://github.com/zhaarey/apple-music-downloader.git
synced 2025-10-23 15:11:05 +00:00
add check m3u8
This commit is contained in:
30
main.go
30
main.go
@@ -45,6 +45,7 @@ type Config struct {
|
||||
CoverFormat string `yaml:"cover-format"`
|
||||
AlacSaveFolder string `yaml:"alac-save-folder"`
|
||||
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
||||
Check string `yaml:"check"`
|
||||
}
|
||||
|
||||
var config Config
|
||||
@@ -1176,6 +1177,35 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
||||
oktrackNum += 1
|
||||
continue
|
||||
}
|
||||
if config.Check != ""{
|
||||
config.Check=strings.TrimSpace(config.Check)
|
||||
if strings.HasSuffix(config.Check, "txt") {
|
||||
txtpath=config.Check
|
||||
}
|
||||
if strings.HasPrefix(config.Check, "http") {
|
||||
req, err := http.NewRequest("GET", config.Check, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
query := req.URL.Query()
|
||||
query.Set("songid", track.ID)
|
||||
req.URL.RawQuery = query.Encode()
|
||||
|
||||
do, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
defer do.Body.Close()
|
||||
|
||||
Checkbody, err := ioutil.ReadAll(do.Body)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
manifest.Attributes.ExtendedAssetUrls.EnhancedHls=string(Checkbody)
|
||||
fmt.Println("Found m3u8 from API")
|
||||
}
|
||||
}
|
||||
if txtpath != "" {
|
||||
file, err := os.Open(txtpath)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user