diff --git a/README.md b/README.md index 19595dd..ab508f5 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ 3. 运行结束后显示总体完成情况 4. 自动内嵌封面和LRC歌词(需要media-user-token,获取方式看最后的说明) 5. 自动构建 可以到 [Actions](https://github.com/zhaarey/apple-music-alac-atmos-downloader/actions) 页面下载最新自动构建版本 可以直接`main.exe url` +6. main_select 支持手动填写m3u8,输入#号 diff --git a/main_select.go b/main_select.go index 85dfa08..5d45f58 100644 --- a/main_select.go +++ b/main_select.go @@ -1147,6 +1147,11 @@ func rip(albumId string, token string, storefront string, userToken string) erro if err != nil { fmt.Println(err) } + manually := false + if strings.Contains(input, "#") { + input = strings.ReplaceAll(input, "#", "") + manually = true + } input = strings.TrimSpace(input) inputs := strings.Fields(input) for _, str := range inputs { @@ -1178,6 +1183,7 @@ func rip(albumId string, token string, storefront string, userToken string) erro continue } filename := fmt.Sprintf("%02d. %s.m4a", trackNum, forbiddenNames.ReplaceAllString(track.Attributes.Name, "_")) + fmt.Println(filename) lrcFilename := fmt.Sprintf("%02d. %s.lrc", trackNum, forbiddenNames.ReplaceAllString(track.Attributes.Name, "_")) trackPath := filepath.Join(sanAlbumFolder, filename) var lrc string = "" @@ -1210,6 +1216,16 @@ func rip(albumId string, token string, storefront string, userToken string) erro fmt.Println("Track already exists locally.") continue } + if manually { + fmt.Print("m3u8: ") + reader := bufio.NewReader(os.Stdin) + m3u8_url, err := reader.ReadString('\n') + if err != nil { + fmt.Println(err) + } + m3u8_url = strings.TrimSpace(m3u8_url) + manifest.Attributes.ExtendedAssetUrls.EnhancedHls=m3u8_url + } trackUrl, keys, err := extractMedia(manifest.Attributes.ExtendedAssetUrls.EnhancedHls) if err != nil { fmt.Println("Failed to extract info from manifest.\n", err)