diff --git a/README.md b/README.md index 906c641..c404ee7 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ 5. 自动构建 可以到 [Actions](https://github.com/zhaarey/apple-music-alac-atmos-downloader/actions) 页面下载最新自动构建版本 可以直接`main.exe url` 6. main_select 支持手动填写m3u8,输入#号,比如#1 #2,支持txt读取m3u8,输入txt文件名 7. main 支持使用 go run main.go "txt文件地址" txt文件名需要指定格式 例如 cn_1707581102_THE BOOK 3.txt 建议使用这个[Reqable 脚本代码](https://telegra.ph/Reqable-For-Apple-Music-05-01) 自动生成 +8. main 支持check 可以填入文本地址 或API数据库 # Apple Music ALAC / Dolby Atmos Downloader diff --git a/config.yaml b/config.yaml index c6a5bcb..dc7427f 100644 --- a/config.yaml +++ b/config.yaml @@ -6,3 +6,4 @@ cover-size: 5000x5000 cover-format: jpg alac-save-folder: AM-DL downloads atmos-save-folder: AM-DL-Atmos downloads +check: "" diff --git a/main.go b/main.go index 43ec8c1..e9eee6c 100644 --- a/main.go +++ b/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 {