add check m3u8

pull/18/head
zhaarey 5 months ago
parent f71feebc18
commit b64bccc400
  1. 1
      README.md
  2. 1
      config.yaml
  3. 30
      main.go

@ -8,6 +8,7 @@
5. 自动构建 可以到 [Actions](https://github.com/zhaarey/apple-music-alac-atmos-downloader/actions) 页面下载最新自动构建版本 可以直接`main.exe url` 5. 自动构建 可以到 [Actions](https://github.com/zhaarey/apple-music-alac-atmos-downloader/actions) 页面下载最新自动构建版本 可以直接`main.exe url`
6. main_select 支持手动填写m3u8,输入#号,比如#1 #2,支持txt读取m3u8,输入txt文件名 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) 自动生成 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 # Apple Music ALAC / Dolby Atmos Downloader

@ -6,3 +6,4 @@ cover-size: 5000x5000
cover-format: jpg cover-format: jpg
alac-save-folder: AM-DL downloads alac-save-folder: AM-DL downloads
atmos-save-folder: AM-DL-Atmos downloads atmos-save-folder: AM-DL-Atmos downloads
check: ""

@ -45,6 +45,7 @@ type Config struct {
CoverFormat string `yaml:"cover-format"` CoverFormat string `yaml:"cover-format"`
AlacSaveFolder string `yaml:"alac-save-folder"` AlacSaveFolder string `yaml:"alac-save-folder"`
AtmosSaveFolder string `yaml:"atmos-save-folder"` AtmosSaveFolder string `yaml:"atmos-save-folder"`
Check string `yaml:"check"`
} }
var config Config var config Config
@ -1176,6 +1177,35 @@ func rip(albumId string, token string, storefront string, userToken string) erro
oktrackNum += 1 oktrackNum += 1
continue 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 != "" { if txtpath != "" {
file, err := os.Open(txtpath) file, err := os.Open(txtpath)
if err != nil { if err != nil {

Loading…
Cancel
Save