mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 13:52:02 +08:00
feat(generate_csv): fetch album mapping from remote instead of local file
This commit is contained in:
parent
eb7ddee0af
commit
f31ff5caa7
@ -37,10 +37,17 @@ func main() {
|
|||||||
panic("API_TOKEN environment variable is required")
|
panic("API_TOKEN environment variable is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 读取相册映射配置
|
// 从远程获取相册映射配置
|
||||||
mappingFile, err := os.ReadFile("lankong_tools/album_mapping.json")
|
resp, err := http.Get("https://github-file-2mq.pages.dev/random-api.czl.net/album_mapping.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("Failed to read album mapping: %v", err))
|
panic(fmt.Sprintf("Failed to fetch album mapping: %v", err))
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
// 读取响应内容
|
||||||
|
mappingFile, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("Failed to read album mapping response: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
var albumMapping AlbumMapping
|
var albumMapping AlbumMapping
|
||||||
|
Loading…
x
Reference in New Issue
Block a user