mirror of
https://github.com/ZxwyWebSite/lx-source.git
synced 2025-05-23 21:37:42 +08:00
2024-03-16 v1.0.3-rc2
This commit is contained in:
parent
0b44b071c0
commit
1ddc08d3b4
2
build.go
2
build.go
@ -56,7 +56,7 @@ func doCompile(v_os, v_arch, v_archv, v_cc string) error {
|
||||
pname := filepath.Clean(ztool.Str_FastConcat(args_path, fname))
|
||||
cmd := ztool.Str_FastConcat(
|
||||
`go build -o `, pname,
|
||||
` -gcflags=-trimpath="`, workDir, `" -asmflags=-trimpath="`, workDir, `" -buildvcs=false`,
|
||||
` -gcflags=-trimpath="`, workDir, `" -asmflags=-trimpath="`, workDir, `" -trimpath -buildvcs=false`,
|
||||
` -ldflags "-s -w -linkmode external" -tags "go_json"`, // go_json | json(std) | jsoniter | sonic
|
||||
)
|
||||
// 输出要执行的命令
|
||||
|
5
go.mod
5
go.mod
@ -6,7 +6,6 @@ require (
|
||||
github.com/ZxwyWebSite/ztool v0.0.1
|
||||
github.com/gin-contrib/gzip v0.0.6
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
@ -23,6 +22,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
@ -32,8 +32,9 @@ require (
|
||||
golang.org/x/arch v0.7.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sys v0.16.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
7
go.sum
7
go.sum
@ -114,16 +114,17 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
|
||||
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
|
52
init.go
52
init.go
@ -5,8 +5,9 @@ import (
|
||||
"lx-source/src/caches"
|
||||
"lx-source/src/caches/localcache"
|
||||
"lx-source/src/env"
|
||||
"lx-source/src/sources"
|
||||
"lx-source/src/sources/builtin"
|
||||
|
||||
// "lx-source/src/sources"
|
||||
// "lx-source/src/sources/builtin"
|
||||
"net/http"
|
||||
stdurl "net/url"
|
||||
"path/filepath"
|
||||
@ -64,6 +65,29 @@ func loadFileLoger() {
|
||||
|
||||
// 初始化基础功能
|
||||
func initMain() {
|
||||
// 载入内存缓存
|
||||
storepath := env.RunPath + env.Config.Main.Store
|
||||
env.Cache.MustRestore(storepath)
|
||||
env.Defer.Add(func() { env.Cache.MustPersist(storepath) })
|
||||
env.Tasker.Add(`memo_flush`, func(*logs.Logger, int64) error {
|
||||
return env.Cache.Persist(storepath)
|
||||
}, 3600, false)
|
||||
|
||||
// 初始化数据库
|
||||
// idb := env.Loger.NewGroup(`InitDB`)
|
||||
// switch `sqlite` {
|
||||
// case `memo`:
|
||||
// break
|
||||
// case `sqlite`:
|
||||
// err := database.InitDB(`data/data.db`)
|
||||
// if err != nil {
|
||||
// idb.Error(`数据库载入失败: %s`, err)
|
||||
// }
|
||||
// default:
|
||||
// idb.Error(`未定义的数据库模式,请检查配置 [DataBase].Mode`)
|
||||
// }
|
||||
// idb.Free()
|
||||
|
||||
// 初始化代理
|
||||
ipr := env.Loger.NewGroup(`InitProxy`)
|
||||
switch env.Config.Source.FakeIP_Mode {
|
||||
@ -167,16 +191,16 @@ func initMain() {
|
||||
icl.Free()
|
||||
|
||||
// 初始化音乐源
|
||||
ise := env.Loger.NewGroup(`InitSource`)
|
||||
switch env.Config.Source.Mode {
|
||||
case `0`, `off`:
|
||||
break
|
||||
case `1`, `builtin`:
|
||||
sources.UseSource = &builtin.Source{}
|
||||
case `2`, `custom`:
|
||||
ise.Fatal(`暂未实现账号解析源`)
|
||||
default:
|
||||
ise.Error(`未定义的音乐源,请检查配置 [Source].Mode,本次启动禁用内置源`)
|
||||
}
|
||||
ise.Free()
|
||||
// ise := env.Loger.NewGroup(`InitSource`)
|
||||
// switch env.Config.Source.Mode {
|
||||
// case `0`, `off`:
|
||||
// break
|
||||
// case `1`, `builtin`:
|
||||
// sources.UseSource = &builtin.Source{}
|
||||
// case `2`, `custom`:
|
||||
// ise.Fatal(`暂未实现账号解析源`)
|
||||
// default:
|
||||
// ise.Error(`未定义的音乐源,请检查配置 [Source].Mode,本次启动禁用内置源`)
|
||||
// }
|
||||
// ise.Free()
|
||||
}
|
||||
|
@ -1 +1,38 @@
|
||||
//go:build gorm
|
||||
|
||||
package database
|
||||
|
||||
// import (
|
||||
// "lx-source/src/database/modules"
|
||||
// "lx-source/src/env"
|
||||
// "lx-source/src/sources"
|
||||
|
||||
// "gorm.io/gorm"
|
||||
// )
|
||||
|
||||
// var DB *gorm.DB
|
||||
|
||||
// func InitDB(dsn string) (err error) {
|
||||
// loger := env.Loger.NewGroup(`InitDB`)
|
||||
// defer loger.Free()
|
||||
// DB, err = gorm.Open(modules.Sqlite(dsn), &gorm.Config{})
|
||||
// if err == nil {
|
||||
// for _, typ := range []struct {
|
||||
// Name string
|
||||
// Type interface{}
|
||||
// }{
|
||||
// {Name: T_music, Type: &XMusicItem{}},
|
||||
// {Name: T_lyric, Type: &XLyricItem{}},
|
||||
// } {
|
||||
// for _, src := range sources.S_al {
|
||||
// err = DB.Table(src + `_` + typ.Name).AutoMigrate(typ.Type)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
// type Driver struct{}
|
||||
|
9
src/database/modules/sqlite_cgo.go
Normal file
9
src/database/modules/sqlite_cgo.go
Normal file
@ -0,0 +1,9 @@
|
||||
//go:build cgo && gorm
|
||||
|
||||
package modules
|
||||
|
||||
// import (
|
||||
// "gorm.io/driver/sqlite"
|
||||
// )
|
||||
|
||||
// var Sqlite = sqlite.Open
|
9
src/database/modules/sqlite_etc.go
Normal file
9
src/database/modules/sqlite_etc.go
Normal file
@ -0,0 +1,9 @@
|
||||
//go:build !cgo && gorm
|
||||
|
||||
package modules
|
||||
|
||||
// import (
|
||||
// "github.com/glebarez/sqlite"
|
||||
// )
|
||||
|
||||
// var Sqlite = sqlite.Open
|
@ -1,23 +1,71 @@
|
||||
//go:build gorm
|
||||
|
||||
package database
|
||||
|
||||
// MusicFree 数据结构
|
||||
// type (
|
||||
// // 其他
|
||||
// IExtra map[string]interface{}
|
||||
// // 音乐
|
||||
// IMusicItem struct {
|
||||
// Artist string `json:"artist"` // 作者
|
||||
// Title string `json:"title"` // 歌曲标题
|
||||
// Duration int `json:"duration,omitempty"` // 时长(s)
|
||||
// Album string `json:"album,omitempty"` // 专辑名
|
||||
// Artwork string `json:"artwork,omitempty"` // 专辑封面图
|
||||
// Url string `json:"url,omitempty"` // 默认音源
|
||||
// Lrc string `json:"lrc,omitempty"` // 歌词URL
|
||||
// RawLrc string `json:"rawLrc,omitempty"` // 歌词文本(lrc格式 带时间戳)
|
||||
// Other IExtra `json:"extra,omitempty"` // 其他
|
||||
// }
|
||||
// // 歌单
|
||||
// IMusicSheetItem struct {
|
||||
// Artwork string `json:"artwork,omitempty"` // 封面图
|
||||
// Title string `json:"title"` // 标题
|
||||
// Description string `json:"description,omitempty"` // 描述
|
||||
// WorksNum int `json:"worksNum,omitempty"` // 作品总数
|
||||
// PlayCount int `json:"playCount,omitempty"` // 播放次数
|
||||
// MusicList []IMusicItem `json:"musicList,omitempty"` // 播放列表
|
||||
// CreateAt int64 `json:"createAt,omitempty"` // 歌单创建日期
|
||||
// Artist string `json:"artist,omitempty"` // 歌单作者
|
||||
// Other IExtra `json:"extra,omitempty"` // 其他
|
||||
// }
|
||||
// // 专辑
|
||||
// IAlbumItem IMusicSheetItem
|
||||
// // 作者
|
||||
// IArtistItem struct {
|
||||
// Platform string `json:"platform,omitempty"` // 插件名
|
||||
// ID interface{} `json:"id"` // 唯一id
|
||||
// Name string `json:"name"` // 姓名
|
||||
// Fans int `json:"fans,omitempty"` // 粉丝数
|
||||
// Description string `json:"description,omitempty"` // 简介
|
||||
// Avatar string `json:"avatar,omitempty"` // 头像
|
||||
// WorksNum int `json:"worksNum,omitempty"` // 作品数目
|
||||
// MusicList []IMusicItem `json:"musicList,omitempty"` // 作者的音乐列表
|
||||
// AlbumList []IAlbumItem `json:"albumList,omitempty"` // 作者的专辑列表
|
||||
// Other IExtra `json:"extra,omitempty"` // 其他
|
||||
// }
|
||||
// )
|
||||
|
||||
// 结构表
|
||||
// type (
|
||||
// PublicKeys struct {
|
||||
// ID string `json:"id" gorm:"primaryKey"`
|
||||
// // 重复
|
||||
// XPublicKeys struct {
|
||||
// ID string `json:"id" gorm:"primaryKey"` // 唯一ID
|
||||
// Exp int64 `json:"exp" gorm:"column:exp"` // 过期时间
|
||||
// }
|
||||
// // 音乐
|
||||
// MusicItem struct {
|
||||
// ID string `json:"id" gorm:"primaryKey"` // 唯一ID
|
||||
// Name string `json:"name" gorm:"column:name"` //
|
||||
// // Source string `json:"source" gorm:"-:all"`
|
||||
// XMusicItem struct {
|
||||
// ID string `json:"id" gorm:"primaryKey"` // 唯一ID
|
||||
// Name string `json:"name" gorm:"column:name"` // 歌曲名称
|
||||
// }
|
||||
// // 作者
|
||||
// ArtistItem struct {
|
||||
// ID string `json:"id" gorm:"primaryKey"`
|
||||
// Name string `json:"name" gorm:"column:name"`
|
||||
// }
|
||||
// // XArtistItem struct {
|
||||
// // ID string `json:"id" gorm:"primaryKey"`
|
||||
// // Name string `json:"name" gorm:"column:name"`
|
||||
// // }
|
||||
// // 歌词
|
||||
// LyricItem struct {
|
||||
// XLyricItem struct {
|
||||
// ID string `json:"id" gorm:"primaryKey"`
|
||||
// Lyric string `json:"lyric" gorm:"column:lyric"` // 歌曲歌词
|
||||
// TLyric string `json:"tlyric" gorm:"column:tlyric"` // 翻译歌词,没有可为 null
|
||||
@ -27,12 +75,23 @@ package database
|
||||
// // 例如: [00:00.000]<0,36>测<36,36>试<50,60>歌<80,75>词
|
||||
// }
|
||||
// // 视频
|
||||
// MovieItem struct {
|
||||
// ID string `json:"id" gorm:"primaryKey"`
|
||||
// Name string `json:"name" gorm:"column:name"`
|
||||
// // XMovieItem struct {
|
||||
// // ID string `json:"id" gorm:"primaryKey"`
|
||||
// // Name string `json:"name" gorm:"column:name"`
|
||||
// // }
|
||||
// // 链接
|
||||
// XLinkItem struct {
|
||||
// ID string `json:"id" gorm:"primaryKey"`
|
||||
// }
|
||||
// )
|
||||
|
||||
// const (
|
||||
// T_artist = `artist`
|
||||
// T_detail = `detail`
|
||||
// T_lyric = `lyric`
|
||||
// T_music = `music`
|
||||
// )
|
||||
|
||||
// 分源表
|
||||
// type (
|
||||
// // Music
|
||||
|
12
src/env/env.go
vendored
12
src/env/env.go
vendored
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Version = `1.0.3-rc1`
|
||||
Version = `1.0.3-rc2`
|
||||
)
|
||||
|
||||
var (
|
||||
@ -37,6 +37,8 @@ type (
|
||||
// FFConv bool `comment:"(实验性) 使用FFMpeg修复音频(本地缓存)"`
|
||||
NgProxy bool `comment:"兼容反向代理(beta)"`
|
||||
Timeout int64 `comment:"网络请求超时(单位:秒,海外服务器可适当调大)"`
|
||||
|
||||
Store string `comment:"内存缓存持久化文件地址"`
|
||||
}
|
||||
// 接口
|
||||
Conf_Apis struct {
|
||||
@ -69,7 +71,7 @@ type (
|
||||
}
|
||||
// 来源
|
||||
Conf_Source struct {
|
||||
Mode string `comment:"音乐来源 0: off(关闭 仅本地), 1: builtin(内置), 2: custom(登录账号 暂不支持)"`
|
||||
// Mode string `comment:"音乐来源 0: off(关闭 仅本地), 1: builtin(内置), 2: custom(登录账号 暂不支持)"`
|
||||
// 伪装IP
|
||||
FakeIP_Mode string `comment:"伪装IP模式 0: off(关闭), 1: req(传入值), 2: val(静态)"`
|
||||
FakeIP_Value string `comment:"静态伪装IP"`
|
||||
@ -108,6 +110,9 @@ type (
|
||||
Mg_Usr_Token string `comment:"field user.token"`
|
||||
Mg_Usr_OSVer string `comment:"field user.osversion"`
|
||||
Mg_Usr_ReqUA string `comment:"field user.useragent"`
|
||||
// mg refresh
|
||||
Mg_Refresh_Enable bool `comment:"是否启用Cookie保活"`
|
||||
Mg_Refresh_Interval int64 `comment:"下次运行时间 (自动更新)"`
|
||||
|
||||
// kw
|
||||
Kw_Enable bool `comment:"是否启用小蜗源"`
|
||||
@ -193,6 +198,7 @@ var (
|
||||
Print: true,
|
||||
SysLev: false,
|
||||
Timeout: 30,
|
||||
Store: `/data/memo.bin`,
|
||||
},
|
||||
Apis: Conf_Apis{
|
||||
// BindAddr: `http://192.168.10.22:1011/`,
|
||||
@ -209,7 +215,7 @@ var (
|
||||
// BanList_White: []string{`127.0.0.1`},
|
||||
},
|
||||
Source: Conf_Source{
|
||||
Mode: `builtin`,
|
||||
// Mode: `builtin`,
|
||||
FakeIP_Mode: `0`,
|
||||
FakeIP_Value: `192.168.10.2`,
|
||||
Proxy_Enable: false,
|
||||
|
@ -2,6 +2,7 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"lx-source/src/env"
|
||||
"lx-source/src/middleware/resp"
|
||||
"sync/atomic"
|
||||
@ -17,6 +18,10 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(RateLimit{})
|
||||
}
|
||||
|
||||
func InitHandler(h gin.HandlerFunc) (out []gin.HandlerFunc) {
|
||||
loger := env.Loger.NewGroup(`AuthHandler`)
|
||||
// RateLimit 速率限制
|
||||
|
@ -92,6 +92,10 @@ func musicHandler(c *gin.Context) {
|
||||
// 定位源方法
|
||||
switch pm {
|
||||
case `url`, `link`:
|
||||
// if !active && pq != sources.Q_128k {
|
||||
// out.Msg = `未激活源仅可试听128k音质`
|
||||
// return out
|
||||
// }
|
||||
// 查询文件缓存
|
||||
var cstat bool
|
||||
if caches.UseCache != nil {
|
||||
@ -127,6 +131,8 @@ func musicHandler(c *gin.Context) {
|
||||
} else {
|
||||
out.Msg = cacheMISS
|
||||
}
|
||||
} else {
|
||||
loger.Warn(`发生错误: %s`, out.Msg)
|
||||
}
|
||||
// 无法获取直链 直接返回原链接
|
||||
env.Cache.Set(cquery, out.Data, source.Exp()-300)
|
||||
|
@ -1,3 +1,5 @@
|
||||
//go:build extapp
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
|
@ -1,3 +1,5 @@
|
||||
//go:build extapp
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
|
@ -1,17 +1,12 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"lx-source/src/caches"
|
||||
"lx-source/src/env"
|
||||
"lx-source/src/middleware/dynlink"
|
||||
"lx-source/src/middleware/resp"
|
||||
"lx-source/src/middleware/util"
|
||||
"lx-source/src/sources"
|
||||
"net/http"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
"github.com/gin-contrib/gzip"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -111,76 +106,76 @@ const (
|
||||
)
|
||||
|
||||
// 外链解析
|
||||
func linkHandler(c *gin.Context) {
|
||||
resp.Wrap(c, func() *resp.Resp {
|
||||
// 获取传入参数 检查合法性
|
||||
arr := util.ParaArr(c, `s`, `id`, `q`)
|
||||
s, id, q := arr[0], arr[1], arr[2]
|
||||
// parms := util.ParaMap(c)
|
||||
// getParam := func(p string) string { return strings.TrimSuffix(strings.TrimPrefix(c.Param(p), `/`), `/`) } //strings.Trim(c.Param(p), `/`)
|
||||
// s := parms[`s`] //c.Param(`s`) //getParam(`s`) // source 平台 wy, mg, kw
|
||||
// id := parms[`id`] //c.Param(`id`) //getParam(`id`) // sid 音乐ID wy: songmid, mg: copyrightId
|
||||
// q := parms[`q`] //c.Param(`q`) //getParam(`q`) // quality 音质 128k / 320k / flac / flac24bit
|
||||
env.Loger.NewGroup(`LinkQuery`).Debug(`s: %v, id: %v, q: %v`, s, id, q).Free()
|
||||
if ztool.Chk_IsNilStr(s, q, id) {
|
||||
return &resp.Resp{Code: 6, Msg: `参数不全`} // http.StatusBadRequest
|
||||
}
|
||||
cquery := caches.NewQuery(s, id, q)
|
||||
cquery.Request = c.Request
|
||||
// fmt.Printf("%+v\n", cquery)
|
||||
defer cquery.Free()
|
||||
// _, ok := sources.UseSource.Verify(cquery) // 获取请求音质 同时检测是否支持(如kw源没有flac24bit) qualitys[q][s]rquery
|
||||
// if !ok {
|
||||
// return &resp.Resp{Code: 6, Msg: `不支持的平台或音质`}
|
||||
// }
|
||||
// func linkHandler(c *gin.Context) {
|
||||
// resp.Wrap(c, func() *resp.Resp {
|
||||
// // 获取传入参数 检查合法性
|
||||
// arr := util.ParaArr(c, `s`, `id`, `q`)
|
||||
// s, id, q := arr[0], arr[1], arr[2]
|
||||
// // parms := util.ParaMap(c)
|
||||
// // getParam := func(p string) string { return strings.TrimSuffix(strings.TrimPrefix(c.Param(p), `/`), `/`) } //strings.Trim(c.Param(p), `/`)
|
||||
// // s := parms[`s`] //c.Param(`s`) //getParam(`s`) // source 平台 wy, mg, kw
|
||||
// // id := parms[`id`] //c.Param(`id`) //getParam(`id`) // sid 音乐ID wy: songmid, mg: copyrightId
|
||||
// // q := parms[`q`] //c.Param(`q`) //getParam(`q`) // quality 音质 128k / 320k / flac / flac24bit
|
||||
// env.Loger.NewGroup(`LinkQuery`).Debug(`s: %v, id: %v, q: %v`, s, id, q).Free()
|
||||
// if ztool.Chk_IsNilStr(s, q, id) {
|
||||
// return &resp.Resp{Code: 6, Msg: `参数不全`} // http.StatusBadRequest
|
||||
// }
|
||||
// cquery := caches.NewQuery(s, id, q)
|
||||
// cquery.Request = c.Request
|
||||
// // fmt.Printf("%+v\n", cquery)
|
||||
// defer cquery.Free()
|
||||
// // _, ok := sources.UseSource.Verify(cquery) // 获取请求音质 同时检测是否支持(如kw源没有flac24bit) qualitys[q][s]rquery
|
||||
// // if !ok {
|
||||
// // return &resp.Resp{Code: 6, Msg: `不支持的平台或音质`}
|
||||
// // }
|
||||
|
||||
// 查询内存
|
||||
if clink, ok := env.Cache.Get(cquery.Query()); ok {
|
||||
if str, ok := clink.(string); ok {
|
||||
env.Loger.NewGroup(`MemCache`).Debug(`MemHIT [%q]=>[%q]`, cquery.Query(), str).Free()
|
||||
if str == `` {
|
||||
return &resp.Resp{Code: 2, Msg: memRej} // 拒绝请求,当前一段时间内解析出错 `MemCache Reject`
|
||||
}
|
||||
return &resp.Resp{Msg: memHIT, Data: str} // `MemCache HIT`
|
||||
}
|
||||
}
|
||||
// 查询缓存
|
||||
var cstat bool
|
||||
if caches.UseCache != nil {
|
||||
cstat = caches.UseCache.Stat()
|
||||
}
|
||||
sc := env.Loger.NewGroup(`StatCache`)
|
||||
defer sc.Free()
|
||||
if cstat {
|
||||
sc.Debug(`Method: Get, Query: %v`, cquery.Query())
|
||||
if link := caches.UseCache.Get(cquery); link != `` {
|
||||
env.Cache.Set(cquery.Query(), link, 3600)
|
||||
return &resp.Resp{Msg: cacheHIT, Data: link}
|
||||
}
|
||||
} else {
|
||||
sc.Debug(`Disabled`)
|
||||
}
|
||||
atomic.AddInt64(&reqnum, 1)
|
||||
// 解析歌曲外链
|
||||
outlink, emsg := sources.UseSource.GetLink(cquery)
|
||||
if emsg != `` {
|
||||
if emsg == sources.Err_Verify { // Verify Failed: 不支持的平台或音质
|
||||
return &resp.Resp{Code: 6, Msg: ztool.Str_FastConcat(emsg, `: 不支持的平台或音质`)}
|
||||
}
|
||||
env.Cache.Set(cquery.Query(), outlink, 600) // 发生错误的10分钟内禁止再次查询
|
||||
return &resp.Resp{Code: 2, Msg: emsg, Data: outlink}
|
||||
}
|
||||
atomic.AddInt64(&secnum, 1)
|
||||
// 缓存并获取直链 !(s == `kg` || (s == `tx` && !tx_en)) => (s != `kg` && (s != `tx` || tx_en))
|
||||
if outlink != `` && cstat && cquery.Source != sources.S_kg && (cquery.Source != sources.S_tx || env.Config.Custom.Tx_Enable) {
|
||||
sc.Debug(`Method: Set, Link: %v`, outlink)
|
||||
if link := caches.UseCache.Set(cquery, outlink); link != `` {
|
||||
env.Cache.Set(cquery.Query(), link, 3600)
|
||||
return &resp.Resp{Msg: cacheSet, Data: link}
|
||||
}
|
||||
}
|
||||
// 无法获取直链 直接返回原链接
|
||||
env.Cache.Set(cquery.Query(), outlink, 1200)
|
||||
return &resp.Resp{Msg: cacheMISS, Data: outlink}
|
||||
})
|
||||
}
|
||||
// // 查询内存
|
||||
// if clink, ok := env.Cache.Get(cquery.Query()); ok {
|
||||
// if str, ok := clink.(string); ok {
|
||||
// env.Loger.NewGroup(`MemCache`).Debug(`MemHIT [%q]=>[%q]`, cquery.Query(), str).Free()
|
||||
// if str == `` {
|
||||
// return &resp.Resp{Code: 2, Msg: memRej} // 拒绝请求,当前一段时间内解析出错 `MemCache Reject`
|
||||
// }
|
||||
// return &resp.Resp{Msg: memHIT, Data: str} // `MemCache HIT`
|
||||
// }
|
||||
// }
|
||||
// // 查询缓存
|
||||
// var cstat bool
|
||||
// if caches.UseCache != nil {
|
||||
// cstat = caches.UseCache.Stat()
|
||||
// }
|
||||
// sc := env.Loger.NewGroup(`StatCache`)
|
||||
// defer sc.Free()
|
||||
// if cstat {
|
||||
// sc.Debug(`Method: Get, Query: %v`, cquery.Query())
|
||||
// if link := caches.UseCache.Get(cquery); link != `` {
|
||||
// env.Cache.Set(cquery.Query(), link, 3600)
|
||||
// return &resp.Resp{Msg: cacheHIT, Data: link}
|
||||
// }
|
||||
// } else {
|
||||
// sc.Debug(`Disabled`)
|
||||
// }
|
||||
// atomic.AddInt64(&reqnum, 1)
|
||||
// // 解析歌曲外链
|
||||
// outlink, emsg := sources.UseSource.GetLink(cquery)
|
||||
// if emsg != `` {
|
||||
// if emsg == sources.Err_Verify { // Verify Failed: 不支持的平台或音质
|
||||
// return &resp.Resp{Code: 6, Msg: ztool.Str_FastConcat(emsg, `: 不支持的平台或音质`)}
|
||||
// }
|
||||
// env.Cache.Set(cquery.Query(), outlink, 600) // 发生错误的10分钟内禁止再次查询
|
||||
// return &resp.Resp{Code: 2, Msg: emsg, Data: outlink}
|
||||
// }
|
||||
// atomic.AddInt64(&secnum, 1)
|
||||
// // 缓存并获取直链 !(s == `kg` || (s == `tx` && !tx_en)) => (s != `kg` && (s != `tx` || tx_en))
|
||||
// if outlink != `` && cstat && cquery.Source != sources.S_kg && (cquery.Source != sources.S_tx || env.Config.Custom.Tx_Enable) {
|
||||
// sc.Debug(`Method: Set, Link: %v`, outlink)
|
||||
// if link := caches.UseCache.Set(cquery, outlink); link != `` {
|
||||
// env.Cache.Set(cquery.Query(), link, 3600)
|
||||
// return &resp.Resp{Msg: cacheSet, Data: link}
|
||||
// }
|
||||
// }
|
||||
// // 无法获取直链 直接返回原链接
|
||||
// env.Cache.Set(cquery.Query(), outlink, 1200)
|
||||
// return &resp.Resp{Msg: cacheMISS, Data: outlink}
|
||||
// })
|
||||
// }
|
||||
|
@ -1,288 +1,288 @@
|
||||
// 内置解析源
|
||||
package builtin
|
||||
|
||||
import (
|
||||
"lx-source/src/caches"
|
||||
"lx-source/src/env"
|
||||
"lx-source/src/sources"
|
||||
"lx-source/src/sources/custom/kg"
|
||||
"lx-source/src/sources/custom/kw"
|
||||
"lx-source/src/sources/custom/mg"
|
||||
"lx-source/src/sources/custom/tx"
|
||||
"lx-source/src/sources/custom/wy"
|
||||
wm "lx-source/src/sources/custom/wy/modules"
|
||||
"lx-source/src/sources/example"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
// import (
|
||||
// "lx-source/src/caches"
|
||||
// "lx-source/src/env"
|
||||
// "lx-source/src/sources"
|
||||
// "lx-source/src/sources/custom/kg"
|
||||
// "lx-source/src/sources/custom/kw"
|
||||
// "lx-source/src/sources/custom/mg"
|
||||
// "lx-source/src/sources/custom/tx"
|
||||
// "lx-source/src/sources/custom/wy"
|
||||
// wm "lx-source/src/sources/custom/wy/modules"
|
||||
// "lx-source/src/sources/example"
|
||||
// "net/http"
|
||||
// "strconv"
|
||||
// "sync"
|
||||
// "time"
|
||||
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
)
|
||||
// "github.com/ZxwyWebSite/ztool"
|
||||
// )
|
||||
|
||||
type Source struct{}
|
||||
// type Source struct{}
|
||||
|
||||
// 预检 (兼容旧接口)
|
||||
func (s *Source) Verify(c *caches.Query) (rquery string, ok bool) {
|
||||
rquery, ok = qualitys[c.Quality][c.Source]
|
||||
return
|
||||
}
|
||||
// // 预检 (兼容旧接口)
|
||||
// func (s *Source) Verify(c *caches.Query) (rquery string, ok bool) {
|
||||
// rquery, ok = qualitys[c.Quality][c.Source]
|
||||
// return
|
||||
// }
|
||||
|
||||
var (
|
||||
// 并发对象池 (用户限制在Router处实现)
|
||||
wy_pool *sync.Pool
|
||||
mg_pool = &sync.Pool{New: func() any { return new(MgApi_Song) }}
|
||||
// kw_pool = &sync.Pool{New: func() any { return new(KwApi_Song) }}
|
||||
// kg_pool = &sync.Pool{New: func() any { return new(KgApi_Song) }}
|
||||
// tx_pool = &sync.Pool{New: func() any { return new(res_tx) }}
|
||||
wv_pool *sync.Pool
|
||||
)
|
||||
// var (
|
||||
// // 并发对象池 (用户限制在Router处实现)
|
||||
// wy_pool *sync.Pool
|
||||
// mg_pool = &sync.Pool{New: func() any { return new(MgApi_Song) }}
|
||||
// // kw_pool = &sync.Pool{New: func() any { return new(KwApi_Song) }}
|
||||
// // kg_pool = &sync.Pool{New: func() any { return new(KgApi_Song) }}
|
||||
// // tx_pool = &sync.Pool{New: func() any { return new(res_tx) }}
|
||||
// wv_pool *sync.Pool
|
||||
// )
|
||||
|
||||
func init() {
|
||||
env.Inits.Add(func() {
|
||||
if env.Config.Source.Enable_Wy {
|
||||
wy_pool = &sync.Pool{New: func() any { return new(wm.PlayInfo) }}
|
||||
if env.Config.Source.MusicIdVerify {
|
||||
wv_pool = &sync.Pool{New: func() any { return new(wm.VerifyInfo) }}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// func init() {
|
||||
// env.Inits.Add(func() {
|
||||
// if env.Config.Source.Enable_Wy {
|
||||
// wy_pool = &sync.Pool{New: func() any { return new(wm.PlayInfo) }}
|
||||
// if env.Config.Source.MusicIdVerify {
|
||||
// wv_pool = &sync.Pool{New: func() any { return new(wm.VerifyInfo) }}
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
// 查询
|
||||
func (s *Source) GetLink(c *caches.Query) (outlink string, msg string) {
|
||||
rquery, ok := s.Verify(c)
|
||||
if !ok /*&& c.Source != `tx`*/ {
|
||||
msg = sources.Err_Verify //`Verify Failed`
|
||||
return
|
||||
}
|
||||
// var outlink string
|
||||
jx := env.Loger.NewGroup(`Sources`) //sources.Loger.AppGroup(`builtin`) //env.Loger.NewGroup(`JieXiApis`)
|
||||
defer jx.Free()
|
||||
switch c.Source {
|
||||
case sources.S_wy:
|
||||
if !env.Config.Source.Enable_Wy {
|
||||
msg = sources.ErrDisable
|
||||
return
|
||||
}
|
||||
if wy.Url != nil {
|
||||
outlink, msg = wy.Url(c.MusicID, c.Quality)
|
||||
break
|
||||
}
|
||||
// 可用性验证
|
||||
if env.Config.Source.MusicIdVerify {
|
||||
vef := wv_pool.Get().(*wm.VerifyInfo)
|
||||
defer wv_pool.Put(vef)
|
||||
vurl := ztool.Str_FastConcat(`https://`, example.Vef_wy, `&id=`, c.MusicID)
|
||||
_, err := ztool.Net_HttpReq(http.MethodGet, vurl, nil, example.Header_wy, &vef)
|
||||
if err != nil {
|
||||
jx.Error(`Wy, VefReq: %s`, err)
|
||||
msg = sources.ErrHttpReq
|
||||
return
|
||||
}
|
||||
jx.Debug(`Wy, Vef: %+v`, vef)
|
||||
if vef.Code != 200 || !vef.Success {
|
||||
msg = ztool.Str_FastConcat(`暂不可用:`, vef.Message)
|
||||
return
|
||||
}
|
||||
}
|
||||
// 获取外链
|
||||
resp := wy_pool.Get().(*wm.PlayInfo)
|
||||
defer wy_pool.Put(resp)
|
||||
// 分流逻辑 (暂无其它节点)
|
||||
// urls := [...]string{
|
||||
// ztool.Str_FastConcat(`http://`, api_wy, `?id=`, c.MusicID, `&level=`, rquery, `&noCookie=true`),
|
||||
// ztool.Str_FastConcat(`https://`, api_wy, `&id=`, c.MusicID, `&level=`, rquery, `&encodeType=`, c.Extname),
|
||||
// }
|
||||
// url := urls[rand.Intn(len(urls))]
|
||||
url := ztool.Str_FastConcat(
|
||||
`https://`, example.Api_wy, `&id=`, c.MusicID, `&level=`, rquery,
|
||||
`×tamp=`, strconv.FormatInt(time.Now().UnixMilli(), 10),
|
||||
)
|
||||
// jx.Debug(`Wy, Url: %v`, url)
|
||||
// wy源增加后端重试 默认3次
|
||||
for i := 0; true; i++ {
|
||||
_, err := ztool.Net_HttpReq(http.MethodGet, url, nil, example.Header_wy, &resp)
|
||||
if err != nil {
|
||||
jx.Error(`HttpReq, Err: %s, ReTry: %v`, err, i)
|
||||
if i > 3 {
|
||||
jx.Error(`Wy, HttpReq: %s`, err)
|
||||
msg = sources.ErrHttpReq
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
jx.Debug(`Wy, Resp: %+v`, resp)
|
||||
if len(resp.Data) == 0 {
|
||||
msg = `No Data:Api接口忙,请稍后重试`
|
||||
return
|
||||
}
|
||||
var data = resp.Data[0]
|
||||
if data.Code != 200 || data.FreeTrialInfo != nil {
|
||||
// jx.Error("发生错误, 返回数据:\n%#v", resp)
|
||||
msg = `触发风控或专辑单独收费: ` + strconv.Itoa(data.Code)
|
||||
return
|
||||
}
|
||||
if data.Level != rquery {
|
||||
msg = ztool.Str_FastConcat(`实际音质不匹配: `, rquery, ` <= `, data.Level) // 实际音质不匹配: exhigh <= standard
|
||||
if !env.Config.Source.ForceFallback {
|
||||
return
|
||||
}
|
||||
}
|
||||
// jx.Info(`WyLink, RealQuality: %v`, data.Level)
|
||||
outlink = data.URL
|
||||
case sources.S_mg:
|
||||
if !env.Config.Source.Enable_Mg {
|
||||
msg = sources.ErrDisable
|
||||
return
|
||||
}
|
||||
if len(c.MusicID) != 11 {
|
||||
msg = sources.E_VefMusicId
|
||||
return
|
||||
}
|
||||
if mg.Url != nil {
|
||||
outlink, msg = mg.Url(c.MusicID, c.Quality)
|
||||
break
|
||||
}
|
||||
resp := mg_pool.Get().(*MgApi_Song)
|
||||
defer mg_pool.Put(resp)
|
||||
// // 查询
|
||||
// func (s *Source) GetLink(c *caches.Query) (outlink string, msg string) {
|
||||
// rquery, ok := s.Verify(c)
|
||||
// if !ok /*&& c.Source != `tx`*/ {
|
||||
// msg = sources.Err_Verify //`Verify Failed`
|
||||
// return
|
||||
// }
|
||||
// // var outlink string
|
||||
// jx := env.Loger.NewGroup(`Sources`) //sources.Loger.AppGroup(`builtin`) //env.Loger.NewGroup(`JieXiApis`)
|
||||
// defer jx.Free()
|
||||
// switch c.Source {
|
||||
// case sources.S_wy:
|
||||
// if !env.Config.Source.Enable_Wy {
|
||||
// msg = sources.ErrDisable
|
||||
// return
|
||||
// }
|
||||
// if wy.Url != nil {
|
||||
// outlink, msg = wy.Url(c.MusicID, c.Quality)
|
||||
// break
|
||||
// }
|
||||
// // 可用性验证
|
||||
// if env.Config.Source.MusicIdVerify {
|
||||
// vef := wv_pool.Get().(*wm.VerifyInfo)
|
||||
// defer wv_pool.Put(vef)
|
||||
// vurl := ztool.Str_FastConcat(`https://`, example.Vef_wy, `&id=`, c.MusicID)
|
||||
// _, err := ztool.Net_HttpReq(http.MethodGet, vurl, nil, example.Header_wy, &vef)
|
||||
// if err != nil {
|
||||
// jx.Error(`Wy, VefReq: %s`, err)
|
||||
// msg = sources.ErrHttpReq
|
||||
// return
|
||||
// }
|
||||
// jx.Debug(`Wy, Vef: %+v`, vef)
|
||||
// if vef.Code != 200 || !vef.Success {
|
||||
// msg = ztool.Str_FastConcat(`暂不可用:`, vef.Message)
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// // 获取外链
|
||||
// resp := wy_pool.Get().(*wm.PlayInfo)
|
||||
// defer wy_pool.Put(resp)
|
||||
// // 分流逻辑 (暂无其它节点)
|
||||
// // urls := [...]string{
|
||||
// // ztool.Str_FastConcat(`http://`, api_wy, `?id=`, c.MusicID, `&level=`, rquery, `&noCookie=true`),
|
||||
// // ztool.Str_FastConcat(`https://`, api_wy, `&id=`, c.MusicID, `&level=`, rquery, `&encodeType=`, c.Extname),
|
||||
// // }
|
||||
// // url := urls[rand.Intn(len(urls))]
|
||||
// url := ztool.Str_FastConcat(
|
||||
// `https://`, example.Api_wy, `&id=`, c.MusicID, `&level=`, rquery,
|
||||
// `×tamp=`, strconv.FormatInt(time.Now().UnixMilli(), 10),
|
||||
// )
|
||||
// // jx.Debug(`Wy, Url: %v`, url)
|
||||
// // wy源增加后端重试 默认3次
|
||||
// for i := 0; true; i++ {
|
||||
// _, err := ztool.Net_HttpReq(http.MethodGet, url, nil, example.Header_wy, &resp)
|
||||
// if err != nil {
|
||||
// jx.Error(`HttpReq, Err: %s, ReTry: %v`, err, i)
|
||||
// if i > 3 {
|
||||
// jx.Error(`Wy, HttpReq: %s`, err)
|
||||
// msg = sources.ErrHttpReq
|
||||
// return
|
||||
// }
|
||||
// time.Sleep(time.Second)
|
||||
// continue
|
||||
// }
|
||||
// break
|
||||
// }
|
||||
// jx.Debug(`Wy, Resp: %+v`, resp)
|
||||
// if len(resp.Data) == 0 {
|
||||
// msg = `No Data:Api接口忙,请稍后重试`
|
||||
// return
|
||||
// }
|
||||
// var data = resp.Data[0]
|
||||
// if data.Code != 200 || data.FreeTrialInfo != nil {
|
||||
// // jx.Error("发生错误, 返回数据:\n%#v", resp)
|
||||
// msg = `触发风控或专辑单独收费: ` + strconv.Itoa(data.Code)
|
||||
// return
|
||||
// }
|
||||
// if data.Level != rquery {
|
||||
// msg = ztool.Str_FastConcat(`实际音质不匹配: `, rquery, ` <= `, data.Level) // 实际音质不匹配: exhigh <= standard
|
||||
// if !env.Config.Source.ForceFallback {
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// // jx.Info(`WyLink, RealQuality: %v`, data.Level)
|
||||
// outlink = data.URL
|
||||
// case sources.S_mg:
|
||||
// if !env.Config.Source.Enable_Mg {
|
||||
// msg = sources.ErrDisable
|
||||
// return
|
||||
// }
|
||||
// if len(c.MusicID) != 11 {
|
||||
// msg = sources.E_VefMusicId
|
||||
// return
|
||||
// }
|
||||
// if mg.Url != nil {
|
||||
// outlink, msg = mg.Url(c.MusicID, c.Quality)
|
||||
// break
|
||||
// }
|
||||
// resp := mg_pool.Get().(*MgApi_Song)
|
||||
// defer mg_pool.Put(resp)
|
||||
|
||||
url := ztool.Str_FastConcat(`https://`, example.Api_mg, `?copyrightId=`, c.MusicID, `&type=`, rquery)
|
||||
// jx.Debug(`Mg, Url: %v`, url)
|
||||
_, err := ztool.Net_HttpReq(http.MethodGet, url, nil, example.Header_mg, &resp)
|
||||
if err != nil {
|
||||
jx.Error(`Mg, HttpReq: %s`, err)
|
||||
msg = sources.ErrHttpReq
|
||||
return
|
||||
}
|
||||
jx.Debug(`Mg, Resp: %+v`, resp)
|
||||
if link := resp.Data.PlayURL; link != `` {
|
||||
outlink = `https:` + link
|
||||
} else {
|
||||
msg = ztool.Str_FastConcat(resp.Code, `: `, resp.Msg)
|
||||
}
|
||||
case sources.S_kw:
|
||||
if !env.Config.Source.Enable_Kw {
|
||||
msg = sources.ErrDisable
|
||||
return
|
||||
}
|
||||
outlink, msg = kw.Url(c.MusicID, c.Quality)
|
||||
// if emsg != `` {
|
||||
// msg = emsg
|
||||
// return
|
||||
// }
|
||||
// outlink = ourl
|
||||
case sources.S_kg:
|
||||
if !env.Config.Source.Enable_Kg {
|
||||
msg = sources.ErrDisable
|
||||
return
|
||||
}
|
||||
if len(c.MusicID) != 32 {
|
||||
msg = sources.E_VefMusicId
|
||||
return
|
||||
}
|
||||
outlink, msg = kg.Url(c.MusicID, c.Quality)
|
||||
// if emsg != `` {
|
||||
// msg = emsg
|
||||
// return
|
||||
// }
|
||||
// outlink = ourl
|
||||
// case sources.S_kg:
|
||||
// if !env.Config.Custom.Kg_Enable {
|
||||
// msg = sources.ErrDisable
|
||||
// return
|
||||
// }
|
||||
// resp := kg_pool.Get().(*KgApi_Song)
|
||||
// defer kg_pool.Put(resp)
|
||||
// url := ztool.Str_FastConcat(`https://`, example.Api_mg, `?copyrightId=`, c.MusicID, `&type=`, rquery)
|
||||
// // jx.Debug(`Mg, Url: %v`, url)
|
||||
// _, err := ztool.Net_HttpReq(http.MethodGet, url, nil, example.Header_mg, &resp)
|
||||
// if err != nil {
|
||||
// jx.Error(`Mg, HttpReq: %s`, err)
|
||||
// msg = sources.ErrHttpReq
|
||||
// return
|
||||
// }
|
||||
// jx.Debug(`Mg, Resp: %+v`, resp)
|
||||
// if link := resp.Data.PlayURL; link != `` {
|
||||
// outlink = `https:` + link
|
||||
// } else {
|
||||
// msg = ztool.Str_FastConcat(resp.Code, `: `, resp.Msg)
|
||||
// }
|
||||
// case sources.S_kw:
|
||||
// if !env.Config.Source.Enable_Kw {
|
||||
// msg = sources.ErrDisable
|
||||
// return
|
||||
// }
|
||||
// outlink, msg = kw.Url(c.MusicID, c.Quality)
|
||||
// // if emsg != `` {
|
||||
// // msg = emsg
|
||||
// // return
|
||||
// // }
|
||||
// // outlink = ourl
|
||||
// case sources.S_kg:
|
||||
// if !env.Config.Source.Enable_Kg {
|
||||
// msg = sources.ErrDisable
|
||||
// return
|
||||
// }
|
||||
// if len(c.MusicID) != 32 {
|
||||
// msg = sources.E_VefMusicId
|
||||
// return
|
||||
// }
|
||||
// outlink, msg = kg.Url(c.MusicID, c.Quality)
|
||||
// // if emsg != `` {
|
||||
// // msg = emsg
|
||||
// // return
|
||||
// // }
|
||||
// // outlink = ourl
|
||||
// // case sources.S_kg:
|
||||
// // if !env.Config.Custom.Kg_Enable {
|
||||
// // msg = sources.ErrDisable
|
||||
// // return
|
||||
// // }
|
||||
// // resp := kg_pool.Get().(*KgApi_Song)
|
||||
// // defer kg_pool.Put(resp)
|
||||
|
||||
// // sep := strings.Split(c.MusicID, `-`) // 分割 Hash-Album 如 6DC276334F56E22BE2A0E8254D332B45-13097991
|
||||
// // alb := func() string {
|
||||
// // if len(sep) >= 2 {
|
||||
// // return sep[1]
|
||||
// // }
|
||||
// // return ``
|
||||
// // }()
|
||||
// sep := c.Split()
|
||||
// url := ztool.Str_FastConcat(api_kg, `&hash=`, sep[0], `&album_id=`, sep[1], `&_=`, strconv.FormatInt(time.Now().UnixMilli(), 10))
|
||||
// // jx.Debug(`Kg, Url: %s`, url)
|
||||
// _, err := ztool.Net_HttpReq(http.MethodGet, url, nil, nil, &resp)
|
||||
// if err != nil {
|
||||
// jx.Error(`Kg, HttpReq: %s`, err)
|
||||
// msg = sources.ErrHttpReq
|
||||
// return
|
||||
// }
|
||||
// jx.Debug(`Kg, Resp: %+v`, resp)
|
||||
// if resp.ErrCode != 0 {
|
||||
// msg = ztool.Str_FastConcat(`Error: `, strconv.Itoa(resp.ErrCode))
|
||||
// return
|
||||
// }
|
||||
// var data KgApi_Data
|
||||
// err = ztool.Val_MapToStruct(resp.Data, &data)
|
||||
// if err != nil {
|
||||
// msg = err.Error()
|
||||
// return
|
||||
// }
|
||||
// if data.PlayBackupURL == `` {
|
||||
// if data.PlayURL == `` {
|
||||
// msg = sources.ErrNoLink
|
||||
// return
|
||||
// }
|
||||
// outlink = data.PlayURL
|
||||
// }
|
||||
// outlink = data.PlayBackupURL
|
||||
case sources.S_tx:
|
||||
if !env.Config.Source.Enable_Tx {
|
||||
msg = sources.ErrDisable
|
||||
return
|
||||
}
|
||||
if len(c.MusicID) != 14 {
|
||||
msg = sources.E_VefMusicId
|
||||
return
|
||||
}
|
||||
outlink, msg = tx.Url(c.MusicID, c.Quality)
|
||||
// if emsg != `` {
|
||||
// msg = emsg
|
||||
// return
|
||||
// }
|
||||
// outlink = ourl
|
||||
// case `otx`:
|
||||
// resp := tx_pool.Get().(*res_tx)
|
||||
// defer tx_pool.Put(resp)
|
||||
// // // sep := strings.Split(c.MusicID, `-`) // 分割 Hash-Album 如 6DC276334F56E22BE2A0E8254D332B45-13097991
|
||||
// // // alb := func() string {
|
||||
// // // if len(sep) >= 2 {
|
||||
// // // return sep[1]
|
||||
// // // }
|
||||
// // // return ``
|
||||
// // // }()
|
||||
// // sep := c.Split()
|
||||
// // url := ztool.Str_FastConcat(api_kg, `&hash=`, sep[0], `&album_id=`, sep[1], `&_=`, strconv.FormatInt(time.Now().UnixMilli(), 10))
|
||||
// // // jx.Debug(`Kg, Url: %s`, url)
|
||||
// // _, err := ztool.Net_HttpReq(http.MethodGet, url, nil, nil, &resp)
|
||||
// // if err != nil {
|
||||
// // jx.Error(`Kg, HttpReq: %s`, err)
|
||||
// // msg = sources.ErrHttpReq
|
||||
// // return
|
||||
// // }
|
||||
// // jx.Debug(`Kg, Resp: %+v`, resp)
|
||||
// // if resp.ErrCode != 0 {
|
||||
// // msg = ztool.Str_FastConcat(`Error: `, strconv.Itoa(resp.ErrCode))
|
||||
// // return
|
||||
// // }
|
||||
// // var data KgApi_Data
|
||||
// // err = ztool.Val_MapToStruct(resp.Data, &data)
|
||||
// // if err != nil {
|
||||
// // msg = err.Error()
|
||||
// // return
|
||||
// // }
|
||||
// // if data.PlayBackupURL == `` {
|
||||
// // if data.PlayURL == `` {
|
||||
// // msg = sources.ErrNoLink
|
||||
// // return
|
||||
// // }
|
||||
// // outlink = data.PlayURL
|
||||
// // }
|
||||
// // outlink = data.PlayBackupURL
|
||||
// case sources.S_tx:
|
||||
// if !env.Config.Source.Enable_Tx {
|
||||
// msg = sources.ErrDisable
|
||||
// return
|
||||
// }
|
||||
// if len(c.MusicID) != 14 {
|
||||
// msg = sources.E_VefMusicId
|
||||
// return
|
||||
// }
|
||||
// outlink, msg = tx.Url(c.MusicID, c.Quality)
|
||||
// // if emsg != `` {
|
||||
// // msg = emsg
|
||||
// // return
|
||||
// // }
|
||||
// // outlink = ourl
|
||||
// // case `otx`:
|
||||
// // resp := tx_pool.Get().(*res_tx)
|
||||
// // defer tx_pool.Put(resp)
|
||||
|
||||
// sep := c.Split()
|
||||
// url := ztool.Str_FastConcat(api_tx,
|
||||
// `{"comm":{"ct":24,"cv":0,"format":"json","uin":"10086"},"req":{"method":"GetCdnDispatch","module":"CDN.SrfCdnDispatchServer","param":{"calltype":0,"guid":"1535153710","userip":""}},"req_0":{"method":"CgiGetVkey","module":"vkey.GetVkeyServer","param":{`,
|
||||
// func(s string) string {
|
||||
// if s == `` {
|
||||
// return ``
|
||||
// }
|
||||
// return ztool.Str_FastConcat(`"filename":["`, rquery, s, `.`, c.Extname, `"],`)
|
||||
// }(sep[1]),
|
||||
// `"guid":"1535153710","loginflag":1,"platform":"20","songmid":["`, sep[0], `"],"songtype":[0],"uin":"10086"}}}`,
|
||||
// )
|
||||
// // jx.Debug(`Tx, Url: %s`, url)
|
||||
// out, err := ztool.Net_HttpReq(http.MethodGet, url, nil, header_tx, &resp)
|
||||
// if err != nil {
|
||||
// jx.Error(`Tx, HttpReq: %s`, err)
|
||||
// msg = errHttpReq
|
||||
// return
|
||||
// }
|
||||
// jx.Debug(`Tx, Resp: %s`, out)
|
||||
// if resp.Code != 0 {
|
||||
// msg = ztool.Str_FastConcat(`Error: `, strconv.Itoa(resp.Code))
|
||||
// return
|
||||
// }
|
||||
// if resp.Req0.Data.Midurlinfo[0].Purl == `` {
|
||||
// msg = errNoLink
|
||||
// return
|
||||
// }
|
||||
// outlink = ztool.Str_FastConcat(`https://dl.stream.qqmusic.qq.com/`, resp.Req0.Data.Midurlinfo[0].Purl)
|
||||
default:
|
||||
msg = `不支持的平台`
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
// // sep := c.Split()
|
||||
// // url := ztool.Str_FastConcat(api_tx,
|
||||
// // `{"comm":{"ct":24,"cv":0,"format":"json","uin":"10086"},"req":{"method":"GetCdnDispatch","module":"CDN.SrfCdnDispatchServer","param":{"calltype":0,"guid":"1535153710","userip":""}},"req_0":{"method":"CgiGetVkey","module":"vkey.GetVkeyServer","param":{`,
|
||||
// // func(s string) string {
|
||||
// // if s == `` {
|
||||
// // return ``
|
||||
// // }
|
||||
// // return ztool.Str_FastConcat(`"filename":["`, rquery, s, `.`, c.Extname, `"],`)
|
||||
// // }(sep[1]),
|
||||
// // `"guid":"1535153710","loginflag":1,"platform":"20","songmid":["`, sep[0], `"],"songtype":[0],"uin":"10086"}}}`,
|
||||
// // )
|
||||
// // // jx.Debug(`Tx, Url: %s`, url)
|
||||
// // out, err := ztool.Net_HttpReq(http.MethodGet, url, nil, header_tx, &resp)
|
||||
// // if err != nil {
|
||||
// // jx.Error(`Tx, HttpReq: %s`, err)
|
||||
// // msg = errHttpReq
|
||||
// // return
|
||||
// // }
|
||||
// // jx.Debug(`Tx, Resp: %s`, out)
|
||||
// // if resp.Code != 0 {
|
||||
// // msg = ztool.Str_FastConcat(`Error: `, strconv.Itoa(resp.Code))
|
||||
// // return
|
||||
// // }
|
||||
// // if resp.Req0.Data.Midurlinfo[0].Purl == `` {
|
||||
// // msg = errNoLink
|
||||
// // return
|
||||
// // }
|
||||
// // outlink = ztool.Str_FastConcat(`https://dl.stream.qqmusic.qq.com/`, resp.Req0.Data.Midurlinfo[0].Purl)
|
||||
// default:
|
||||
// msg = `不支持的平台`
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
@ -1,274 +1,274 @@
|
||||
package builtin
|
||||
|
||||
import (
|
||||
"lx-source/src/sources"
|
||||
)
|
||||
|
||||
type (
|
||||
// 网易音乐接口 (方格/简繁)
|
||||
// WyApi_Song struct {
|
||||
// Data []struct {
|
||||
// ID int `json:"id"`
|
||||
// URL string `json:"url"`
|
||||
// Br int `json:"br"`
|
||||
// Size int `json:"size"`
|
||||
// Md5 string `json:"md5"`
|
||||
// Code int `json:"code"`
|
||||
// Expi int `json:"expi"`
|
||||
// Type string `json:"type"`
|
||||
// Gain float64 `json:"gain"`
|
||||
// Peak float64 `json:"peak"`
|
||||
// Fee int `json:"fee"`
|
||||
// Uf interface{} `json:"uf"`
|
||||
// Payed int `json:"payed"`
|
||||
// Flag int `json:"flag"`
|
||||
// CanExtend bool `json:"canExtend"`
|
||||
// FreeTrialInfo interface{} `json:"freeTrialInfo"`
|
||||
// Level string `json:"level"`
|
||||
// EncodeType string `json:"encodeType"`
|
||||
// FreeTrialPrivilege struct {
|
||||
// ResConsumable bool `json:"resConsumable"`
|
||||
// UserConsumable bool `json:"userConsumable"`
|
||||
// ListenType interface{} `json:"listenType"`
|
||||
// CannotListenReason interface{} `json:"cannotListenReason"`
|
||||
// PlayReason interface{} `json:"playReason"`
|
||||
// } `json:"freeTrialPrivilege"`
|
||||
// FreeTimeTrialPrivilege struct {
|
||||
// ResConsumable bool `json:"resConsumable"`
|
||||
// UserConsumable bool `json:"userConsumable"`
|
||||
// Type int `json:"type"`
|
||||
// RemainTime int `json:"remainTime"`
|
||||
// } `json:"freeTimeTrialPrivilege"`
|
||||
// URLSource int `json:"urlSource"`
|
||||
// RightSource int `json:"rightSource"`
|
||||
// PodcastCtrp interface{} `json:"podcastCtrp"`
|
||||
// EffectTypes interface{} `json:"effectTypes"`
|
||||
// Time int `json:"time"`
|
||||
// } `json:"data"`
|
||||
// Code int `json:"code"`
|
||||
// }
|
||||
// WyApi_Vef struct {
|
||||
// Code int16 `json:"code"`
|
||||
// Success bool `json:"success"`
|
||||
// Message string `json:"message"`
|
||||
// }
|
||||
// 咪咕音乐接口
|
||||
MgApi_Song struct {
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
PlayURL string `json:"playUrl"`
|
||||
FormatID string `json:"formatId"`
|
||||
SalePrice string `json:"salePrice"`
|
||||
BizType string `json:"bizType"`
|
||||
BizCode string `json:"bizCode"`
|
||||
AuditionsLength int `json:"auditionsLength"`
|
||||
} `json:"data"`
|
||||
}
|
||||
// 酷我音乐接口 (波点)
|
||||
// KwApi_Song struct {
|
||||
// Code int `json:"code"`
|
||||
// Msg string `json:"msg"`
|
||||
// ReqID string `json:"reqId"`
|
||||
// Data struct {
|
||||
// Duration int `json:"duration"`
|
||||
// AudioInfo struct {
|
||||
// Bitrate string `json:"bitrate"`
|
||||
// Format string `json:"format"`
|
||||
// Level string `json:"level"`
|
||||
// Size string `json:"size"`
|
||||
// } `json:"audioInfo"`
|
||||
// URL string `json:"url"`
|
||||
// } `json:"data"`
|
||||
// ProfileID string `json:"profileId"`
|
||||
// CurTime int64 `json:"curTime"`
|
||||
// }
|
||||
// 酷狗试听接口
|
||||
// KgApi_Song struct {
|
||||
// Status int `json:"status"`
|
||||
// ErrCode int `json:"err_code"`
|
||||
// Data any `json:"data"`
|
||||
// }
|
||||
// KgApi_Data struct {
|
||||
// // Hash string `json:"hash"`
|
||||
// // Timelength int `json:"timelength"`
|
||||
// // Filesize int `json:"filesize"`
|
||||
// // AudioName string `json:"audio_name"`
|
||||
// // HaveAlbum int `json:"have_album"`
|
||||
// // AlbumName string `json:"album_name"`
|
||||
// // AlbumID any `json:"album_id"`
|
||||
// // Img string `json:"img"`
|
||||
// // HaveMv int `json:"have_mv"`
|
||||
// // VideoID any `json:"video_id"`
|
||||
// // AuthorName string `json:"author_name"`
|
||||
// // SongName string `json:"song_name"`
|
||||
// // Lyrics string `json:"lyrics"`
|
||||
// // AuthorID any `json:"author_id"`
|
||||
// // Privilege int `json:"privilege"`
|
||||
// // Privilege2 string `json:"privilege2"`
|
||||
// PlayURL string `json:"play_url"`
|
||||
// // Authors []struct {
|
||||
// // AuthorID any `json:"author_id"`
|
||||
// // AuthorName string `json:"author_name"`
|
||||
// // IsPublish string `json:"is_publish"`
|
||||
// // SizableAvatar string `json:"sizable_avatar"`
|
||||
// // EAuthorID string `json:"e_author_id"`
|
||||
// // Avatar string `json:"avatar"`
|
||||
// // } `json:"authors"`
|
||||
// // IsFreePart int `json:"is_free_part"`
|
||||
// // Bitrate int `json:"bitrate"`
|
||||
// // RecommendAlbumID string `json:"recommend_album_id"`
|
||||
// // StoreType string `json:"store_type"`
|
||||
// // AlbumAudioID int `json:"album_audio_id"`
|
||||
// // IsPublish int `json:"is_publish"`
|
||||
// // EAuthorID string `json:"e_author_id"`
|
||||
// // AudioID any `json:"audio_id"`
|
||||
// // HasPrivilege bool `json:"has_privilege"`
|
||||
// PlayBackupURL string `json:"play_backup_url"`
|
||||
// // SmallLibrarySong int `json:"small_library_song"`
|
||||
// // EncodeAlbumID string `json:"encode_album_id"`
|
||||
// // EncodeAlbumAudioID string `json:"encode_album_audio_id"`
|
||||
// // EVideoID string `json:"e_video_id"`
|
||||
// }
|
||||
// 腾讯试听接口
|
||||
// res_tx struct {
|
||||
// Code int `json:"code"`
|
||||
// // Ts int64 `json:"ts"`
|
||||
// // StartTs int64 `json:"start_ts"`
|
||||
// // Traceid string `json:"traceid"`
|
||||
// // Req struct {
|
||||
// // Code int `json:"code"`
|
||||
// // Data struct {
|
||||
// // Expiration int `json:"expiration"`
|
||||
// // Freeflowsip []string `json:"freeflowsip"`
|
||||
// // Keepalivefile string `json:"keepalivefile"`
|
||||
// // Msg string `json:"msg"`
|
||||
// // Retcode int `json:"retcode"`
|
||||
// // Servercheck string `json:"servercheck"`
|
||||
// // Sip []string `json:"sip"`
|
||||
// // Testfile2G string `json:"testfile2g"`
|
||||
// // Testfilewifi string `json:"testfilewifi"`
|
||||
// // Uin string `json:"uin"`
|
||||
// // Userip string `json:"userip"`
|
||||
// // Vkey string `json:"vkey"`
|
||||
// // } `json:"data"`
|
||||
// // } `json:"req"`
|
||||
// Req0 struct {
|
||||
// Code int `json:"code"`
|
||||
// Data struct {
|
||||
// // Uin string `json:"uin"`
|
||||
// // Retcode int `json:"retcode"`
|
||||
// // VerifyType int `json:"verify_type"`
|
||||
// // LoginKey string `json:"login_key"`
|
||||
// // Msg string `json:"msg"`
|
||||
// // Sip []string `json:"sip"`
|
||||
// // Thirdip []string `json:"thirdip"`
|
||||
// // Testfile2G string `json:"testfile2g"`
|
||||
// // Testfilewifi string `json:"testfilewifi"`
|
||||
// Midurlinfo []struct {
|
||||
// // Songmid string `json:"songmid"`
|
||||
// // Filename string `json:"filename"`
|
||||
// Purl string `json:"purl"`
|
||||
// // Errtype string `json:"errtype"`
|
||||
// // P2Pfromtag int `json:"p2pfromtag"`
|
||||
// // Qmdlfromtag int `json:"qmdlfromtag"`
|
||||
// // CommonDownfromtag int `json:"common_downfromtag"`
|
||||
// // VipDownfromtag int `json:"vip_downfromtag"`
|
||||
// // Pdl int `json:"pdl"`
|
||||
// // Premain int `json:"premain"`
|
||||
// // Hisdown int `json:"hisdown"`
|
||||
// // Hisbuy int `json:"hisbuy"`
|
||||
// // UIAlert int `json:"uiAlert"`
|
||||
// // Isbuy int `json:"isbuy"`
|
||||
// // Pneedbuy int `json:"pneedbuy"`
|
||||
// // Pneed int `json:"pneed"`
|
||||
// // Isonly int `json:"isonly"`
|
||||
// // Onecan int `json:"onecan"`
|
||||
// // Result int `json:"result"`
|
||||
// // Tips string `json:"tips"`
|
||||
// // Opi48Kurl string `json:"opi48kurl"`
|
||||
// // Opi96Kurl string `json:"opi96kurl"`
|
||||
// // Opi192Kurl string `json:"opi192kurl"`
|
||||
// // Opiflackurl string `json:"opiflackurl"`
|
||||
// // Opi128Kurl string `json:"opi128kurl"`
|
||||
// // Opi192Koggurl string `json:"opi192koggurl"`
|
||||
// // Wififromtag string `json:"wififromtag"`
|
||||
// // Flowfromtag string `json:"flowfromtag"`
|
||||
// // Wifiurl string `json:"wifiurl"`
|
||||
// // Flowurl string `json:"flowurl"`
|
||||
// // Vkey string `json:"vkey"`
|
||||
// // Opi30Surl string `json:"opi30surl"`
|
||||
// // Ekey string `json:"ekey"`
|
||||
// // AuthSwitch int `json:"auth_switch"`
|
||||
// // Subcode int `json:"subcode"`
|
||||
// // Opi96Koggurl string `json:"opi96koggurl"`
|
||||
// // AuthSwitch2 int `json:"auth_switch2"`
|
||||
// } `json:"midurlinfo"`
|
||||
// // Servercheck string `json:"servercheck"`
|
||||
// // Expiration int `json:"expiration"`
|
||||
// } `json:"data"`
|
||||
// } `json:"req_0"`
|
||||
// }
|
||||
)
|
||||
|
||||
// const (
|
||||
// // Source
|
||||
// s_wy = `wy`
|
||||
// s_mg = `mg`
|
||||
// s_kw = `kw`
|
||||
// s_kg = `kg`
|
||||
// s_tx = `tx`
|
||||
// // s_lx = `lx`
|
||||
// import (
|
||||
// "lx-source/src/sources"
|
||||
// )
|
||||
|
||||
var (
|
||||
// 音质列表 ( [通用音质][音乐平台]对应音质 )
|
||||
/*
|
||||
注: kg源使用对应hash匹配音质,故为空
|
||||
*/
|
||||
qualitys = map[string]map[string]string{
|
||||
sources.Q_128k: {
|
||||
sources.S_wy: `standard`,
|
||||
sources.S_mg: `1`,
|
||||
sources.S_kw: sources.Q_128k,
|
||||
sources.S_kg: ``,
|
||||
sources.S_tx: `M500`,
|
||||
},
|
||||
sources.Q_320k: {
|
||||
sources.S_wy: `exhigh`,
|
||||
sources.S_mg: `2`,
|
||||
sources.S_kw: sources.Q_320k,
|
||||
sources.S_kg: ``,
|
||||
sources.S_tx: `M800`,
|
||||
},
|
||||
sources.Q_flac: {
|
||||
sources.S_wy: `lossless`,
|
||||
sources.S_mg: `3`,
|
||||
sources.S_kw: `2000k`,
|
||||
sources.S_kg: ``,
|
||||
sources.S_tx: `F000`,
|
||||
},
|
||||
sources.Q_fl24: {
|
||||
sources.S_wy: `hires`,
|
||||
sources.S_mg: `4`,
|
||||
sources.S_kg: ``,
|
||||
// sources.S_tx: `RS01`,
|
||||
},
|
||||
// `fl24`: {
|
||||
// s_wy: `hires`,
|
||||
// s_mg: `4`,
|
||||
// },
|
||||
}
|
||||
// ApiAddr
|
||||
// api_wy string
|
||||
// api_mg string
|
||||
// api_kw string
|
||||
// api_kg string = `https://wwwapi.kugou.com/yy/index.php?r=play/getdata&platid=4&mid=1`
|
||||
// api_tx string = `https://u.y.qq.com/cgi-bin/musicu.fcg?data=`
|
||||
// vef_wy string
|
||||
// Headers
|
||||
// header_wy map[string]string
|
||||
// header_mg map[string]string
|
||||
// header_kw map[string]string
|
||||
// header_tx = map[string]string{`Referer`: `https://y.qq.com/`}
|
||||
)
|
||||
// type (
|
||||
// // 网易音乐接口 (方格/简繁)
|
||||
// // WyApi_Song struct {
|
||||
// // Data []struct {
|
||||
// // ID int `json:"id"`
|
||||
// // URL string `json:"url"`
|
||||
// // Br int `json:"br"`
|
||||
// // Size int `json:"size"`
|
||||
// // Md5 string `json:"md5"`
|
||||
// // Code int `json:"code"`
|
||||
// // Expi int `json:"expi"`
|
||||
// // Type string `json:"type"`
|
||||
// // Gain float64 `json:"gain"`
|
||||
// // Peak float64 `json:"peak"`
|
||||
// // Fee int `json:"fee"`
|
||||
// // Uf interface{} `json:"uf"`
|
||||
// // Payed int `json:"payed"`
|
||||
// // Flag int `json:"flag"`
|
||||
// // CanExtend bool `json:"canExtend"`
|
||||
// // FreeTrialInfo interface{} `json:"freeTrialInfo"`
|
||||
// // Level string `json:"level"`
|
||||
// // EncodeType string `json:"encodeType"`
|
||||
// // FreeTrialPrivilege struct {
|
||||
// // ResConsumable bool `json:"resConsumable"`
|
||||
// // UserConsumable bool `json:"userConsumable"`
|
||||
// // ListenType interface{} `json:"listenType"`
|
||||
// // CannotListenReason interface{} `json:"cannotListenReason"`
|
||||
// // PlayReason interface{} `json:"playReason"`
|
||||
// // } `json:"freeTrialPrivilege"`
|
||||
// // FreeTimeTrialPrivilege struct {
|
||||
// // ResConsumable bool `json:"resConsumable"`
|
||||
// // UserConsumable bool `json:"userConsumable"`
|
||||
// // Type int `json:"type"`
|
||||
// // RemainTime int `json:"remainTime"`
|
||||
// // } `json:"freeTimeTrialPrivilege"`
|
||||
// // URLSource int `json:"urlSource"`
|
||||
// // RightSource int `json:"rightSource"`
|
||||
// // PodcastCtrp interface{} `json:"podcastCtrp"`
|
||||
// // EffectTypes interface{} `json:"effectTypes"`
|
||||
// // Time int `json:"time"`
|
||||
// // } `json:"data"`
|
||||
// // Code int `json:"code"`
|
||||
// // }
|
||||
// // WyApi_Vef struct {
|
||||
// // Code int16 `json:"code"`
|
||||
// // Success bool `json:"success"`
|
||||
// // Message string `json:"message"`
|
||||
// // }
|
||||
// // 咪咕音乐接口
|
||||
// MgApi_Song struct {
|
||||
// Code string `json:"code"`
|
||||
// Msg string `json:"msg"`
|
||||
// Data struct {
|
||||
// PlayURL string `json:"playUrl"`
|
||||
// FormatID string `json:"formatId"`
|
||||
// SalePrice string `json:"salePrice"`
|
||||
// BizType string `json:"bizType"`
|
||||
// BizCode string `json:"bizCode"`
|
||||
// AuditionsLength int `json:"auditionsLength"`
|
||||
// } `json:"data"`
|
||||
// }
|
||||
// // 酷我音乐接口 (波点)
|
||||
// // KwApi_Song struct {
|
||||
// // Code int `json:"code"`
|
||||
// // Msg string `json:"msg"`
|
||||
// // ReqID string `json:"reqId"`
|
||||
// // Data struct {
|
||||
// // Duration int `json:"duration"`
|
||||
// // AudioInfo struct {
|
||||
// // Bitrate string `json:"bitrate"`
|
||||
// // Format string `json:"format"`
|
||||
// // Level string `json:"level"`
|
||||
// // Size string `json:"size"`
|
||||
// // } `json:"audioInfo"`
|
||||
// // URL string `json:"url"`
|
||||
// // } `json:"data"`
|
||||
// // ProfileID string `json:"profileId"`
|
||||
// // CurTime int64 `json:"curTime"`
|
||||
// // }
|
||||
// // 酷狗试听接口
|
||||
// // KgApi_Song struct {
|
||||
// // Status int `json:"status"`
|
||||
// // ErrCode int `json:"err_code"`
|
||||
// // Data any `json:"data"`
|
||||
// // }
|
||||
// // KgApi_Data struct {
|
||||
// // // Hash string `json:"hash"`
|
||||
// // // Timelength int `json:"timelength"`
|
||||
// // // Filesize int `json:"filesize"`
|
||||
// // // AudioName string `json:"audio_name"`
|
||||
// // // HaveAlbum int `json:"have_album"`
|
||||
// // // AlbumName string `json:"album_name"`
|
||||
// // // AlbumID any `json:"album_id"`
|
||||
// // // Img string `json:"img"`
|
||||
// // // HaveMv int `json:"have_mv"`
|
||||
// // // VideoID any `json:"video_id"`
|
||||
// // // AuthorName string `json:"author_name"`
|
||||
// // // SongName string `json:"song_name"`
|
||||
// // // Lyrics string `json:"lyrics"`
|
||||
// // // AuthorID any `json:"author_id"`
|
||||
// // // Privilege int `json:"privilege"`
|
||||
// // // Privilege2 string `json:"privilege2"`
|
||||
// // PlayURL string `json:"play_url"`
|
||||
// // // Authors []struct {
|
||||
// // // AuthorID any `json:"author_id"`
|
||||
// // // AuthorName string `json:"author_name"`
|
||||
// // // IsPublish string `json:"is_publish"`
|
||||
// // // SizableAvatar string `json:"sizable_avatar"`
|
||||
// // // EAuthorID string `json:"e_author_id"`
|
||||
// // // Avatar string `json:"avatar"`
|
||||
// // // } `json:"authors"`
|
||||
// // // IsFreePart int `json:"is_free_part"`
|
||||
// // // Bitrate int `json:"bitrate"`
|
||||
// // // RecommendAlbumID string `json:"recommend_album_id"`
|
||||
// // // StoreType string `json:"store_type"`
|
||||
// // // AlbumAudioID int `json:"album_audio_id"`
|
||||
// // // IsPublish int `json:"is_publish"`
|
||||
// // // EAuthorID string `json:"e_author_id"`
|
||||
// // // AudioID any `json:"audio_id"`
|
||||
// // // HasPrivilege bool `json:"has_privilege"`
|
||||
// // PlayBackupURL string `json:"play_backup_url"`
|
||||
// // // SmallLibrarySong int `json:"small_library_song"`
|
||||
// // // EncodeAlbumID string `json:"encode_album_id"`
|
||||
// // // EncodeAlbumAudioID string `json:"encode_album_audio_id"`
|
||||
// // // EVideoID string `json:"e_video_id"`
|
||||
// // }
|
||||
// // 腾讯试听接口
|
||||
// // res_tx struct {
|
||||
// // Code int `json:"code"`
|
||||
// // // Ts int64 `json:"ts"`
|
||||
// // // StartTs int64 `json:"start_ts"`
|
||||
// // // Traceid string `json:"traceid"`
|
||||
// // // Req struct {
|
||||
// // // Code int `json:"code"`
|
||||
// // // Data struct {
|
||||
// // // Expiration int `json:"expiration"`
|
||||
// // // Freeflowsip []string `json:"freeflowsip"`
|
||||
// // // Keepalivefile string `json:"keepalivefile"`
|
||||
// // // Msg string `json:"msg"`
|
||||
// // // Retcode int `json:"retcode"`
|
||||
// // // Servercheck string `json:"servercheck"`
|
||||
// // // Sip []string `json:"sip"`
|
||||
// // // Testfile2G string `json:"testfile2g"`
|
||||
// // // Testfilewifi string `json:"testfilewifi"`
|
||||
// // // Uin string `json:"uin"`
|
||||
// // // Userip string `json:"userip"`
|
||||
// // // Vkey string `json:"vkey"`
|
||||
// // // } `json:"data"`
|
||||
// // // } `json:"req"`
|
||||
// // Req0 struct {
|
||||
// // Code int `json:"code"`
|
||||
// // Data struct {
|
||||
// // // Uin string `json:"uin"`
|
||||
// // // Retcode int `json:"retcode"`
|
||||
// // // VerifyType int `json:"verify_type"`
|
||||
// // // LoginKey string `json:"login_key"`
|
||||
// // // Msg string `json:"msg"`
|
||||
// // // Sip []string `json:"sip"`
|
||||
// // // Thirdip []string `json:"thirdip"`
|
||||
// // // Testfile2G string `json:"testfile2g"`
|
||||
// // // Testfilewifi string `json:"testfilewifi"`
|
||||
// // Midurlinfo []struct {
|
||||
// // // Songmid string `json:"songmid"`
|
||||
// // // Filename string `json:"filename"`
|
||||
// // Purl string `json:"purl"`
|
||||
// // // Errtype string `json:"errtype"`
|
||||
// // // P2Pfromtag int `json:"p2pfromtag"`
|
||||
// // // Qmdlfromtag int `json:"qmdlfromtag"`
|
||||
// // // CommonDownfromtag int `json:"common_downfromtag"`
|
||||
// // // VipDownfromtag int `json:"vip_downfromtag"`
|
||||
// // // Pdl int `json:"pdl"`
|
||||
// // // Premain int `json:"premain"`
|
||||
// // // Hisdown int `json:"hisdown"`
|
||||
// // // Hisbuy int `json:"hisbuy"`
|
||||
// // // UIAlert int `json:"uiAlert"`
|
||||
// // // Isbuy int `json:"isbuy"`
|
||||
// // // Pneedbuy int `json:"pneedbuy"`
|
||||
// // // Pneed int `json:"pneed"`
|
||||
// // // Isonly int `json:"isonly"`
|
||||
// // // Onecan int `json:"onecan"`
|
||||
// // // Result int `json:"result"`
|
||||
// // // Tips string `json:"tips"`
|
||||
// // // Opi48Kurl string `json:"opi48kurl"`
|
||||
// // // Opi96Kurl string `json:"opi96kurl"`
|
||||
// // // Opi192Kurl string `json:"opi192kurl"`
|
||||
// // // Opiflackurl string `json:"opiflackurl"`
|
||||
// // // Opi128Kurl string `json:"opi128kurl"`
|
||||
// // // Opi192Koggurl string `json:"opi192koggurl"`
|
||||
// // // Wififromtag string `json:"wififromtag"`
|
||||
// // // Flowfromtag string `json:"flowfromtag"`
|
||||
// // // Wifiurl string `json:"wifiurl"`
|
||||
// // // Flowurl string `json:"flowurl"`
|
||||
// // // Vkey string `json:"vkey"`
|
||||
// // // Opi30Surl string `json:"opi30surl"`
|
||||
// // // Ekey string `json:"ekey"`
|
||||
// // // AuthSwitch int `json:"auth_switch"`
|
||||
// // // Subcode int `json:"subcode"`
|
||||
// // // Opi96Koggurl string `json:"opi96koggurl"`
|
||||
// // // AuthSwitch2 int `json:"auth_switch2"`
|
||||
// // } `json:"midurlinfo"`
|
||||
// // // Servercheck string `json:"servercheck"`
|
||||
// // // Expiration int `json:"expiration"`
|
||||
// // } `json:"data"`
|
||||
// // } `json:"req_0"`
|
||||
// // }
|
||||
// )
|
||||
|
||||
// // const (
|
||||
// // // Source
|
||||
// // s_wy = `wy`
|
||||
// // s_mg = `mg`
|
||||
// // s_kw = `kw`
|
||||
// // s_kg = `kg`
|
||||
// // s_tx = `tx`
|
||||
// // // s_lx = `lx`
|
||||
// // )
|
||||
|
||||
// var (
|
||||
// // 音质列表 ( [通用音质][音乐平台]对应音质 )
|
||||
// /*
|
||||
// 注: kg源使用对应hash匹配音质,故为空
|
||||
// */
|
||||
// qualitys = map[string]map[string]string{
|
||||
// sources.Q_128k: {
|
||||
// sources.S_wy: `standard`,
|
||||
// sources.S_mg: `1`,
|
||||
// sources.S_kw: sources.Q_128k,
|
||||
// sources.S_kg: ``,
|
||||
// sources.S_tx: `M500`,
|
||||
// },
|
||||
// sources.Q_320k: {
|
||||
// sources.S_wy: `exhigh`,
|
||||
// sources.S_mg: `2`,
|
||||
// sources.S_kw: sources.Q_320k,
|
||||
// sources.S_kg: ``,
|
||||
// sources.S_tx: `M800`,
|
||||
// },
|
||||
// sources.Q_flac: {
|
||||
// sources.S_wy: `lossless`,
|
||||
// sources.S_mg: `3`,
|
||||
// sources.S_kw: `2000k`,
|
||||
// sources.S_kg: ``,
|
||||
// sources.S_tx: `F000`,
|
||||
// },
|
||||
// sources.Q_fl24: {
|
||||
// sources.S_wy: `hires`,
|
||||
// sources.S_mg: `4`,
|
||||
// sources.S_kg: ``,
|
||||
// // sources.S_tx: `RS01`,
|
||||
// },
|
||||
// // `fl24`: {
|
||||
// // s_wy: `hires`,
|
||||
// // s_mg: `4`,
|
||||
// // },
|
||||
// }
|
||||
// // ApiAddr
|
||||
// // api_wy string
|
||||
// // api_mg string
|
||||
// // api_kw string
|
||||
// // api_kg string = `https://wwwapi.kugou.com/yy/index.php?r=play/getdata&platid=4&mid=1`
|
||||
// // api_tx string = `https://u.y.qq.com/cgi-bin/musicu.fcg?data=`
|
||||
// // vef_wy string
|
||||
// // Headers
|
||||
// // header_wy map[string]string
|
||||
// // header_mg map[string]string
|
||||
// // header_kw map[string]string
|
||||
// // header_tx = map[string]string{`Referer`: `https://y.qq.com/`}
|
||||
// )
|
||||
|
@ -1,7 +1,9 @@
|
||||
package kg
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"lx-source/src/env"
|
||||
"lx-source/src/sources"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -10,6 +12,10 @@ import (
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(musicInfo{})
|
||||
}
|
||||
|
||||
func getMusicInfo(hash_ string) (info musicInfo, emsg string) {
|
||||
cquery := strings.Join([]string{`kg`, hash_, `info`}, `/`)
|
||||
if cdata, ok := env.Cache.Get(cquery); ok {
|
||||
@ -59,6 +65,6 @@ func getMusicInfo(hash_ string) (info musicInfo, emsg string) {
|
||||
}
|
||||
info = infoResp.Data[0][0]
|
||||
emsg = infoResp.Errmsg
|
||||
env.Cache.Set(cquery, info, 7200)
|
||||
env.Cache.Set(cquery, info, sources.C_lx)
|
||||
return
|
||||
}
|
||||
|
@ -89,10 +89,22 @@ func do_account_signin(loger *logs.Logger, now int64) (err error) {
|
||||
// 检查用户配置文件,获取mixsongmid
|
||||
mixid := env.Config.Custom.Kg_Lite_MixId //`582534238`
|
||||
if mixid == `auto` || mixid == `` {
|
||||
mixid, err = randomMixSongMid()
|
||||
if err != nil {
|
||||
return
|
||||
for i := 0; true; i++ {
|
||||
mixid, err = randomMixSongMid()
|
||||
if err != nil {
|
||||
loger.Error(`ReTry: %v, Err: %s`, i, err)
|
||||
if i >= 2 {
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
// mixid, err = randomMixSongMid()
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
loger.Info(`成功获取MixSongMid: ` + mixid)
|
||||
} else {
|
||||
loger.Info(`使用固定MixSongMid: ` + mixid)
|
||||
|
@ -2,454 +2,454 @@ package kg
|
||||
|
||||
type (
|
||||
musicInfo struct {
|
||||
AlbumAudioID string `json:"album_audio_id"`
|
||||
AudioID string `json:"audio_id"`
|
||||
AuthorName string `json:"author_name"`
|
||||
OriAudioName string `json:"ori_audio_name"`
|
||||
OfficialSongname string `json:"official_songname"`
|
||||
Songname string `json:"songname"`
|
||||
Remark string `json:"remark"`
|
||||
SuffixAudioName string `json:"suffix_audio_name"`
|
||||
IsSearch string `json:"is_search"`
|
||||
IsOriginal string `json:"is_original"`
|
||||
IsPublish string `json:"is_publish"`
|
||||
MixsongType string `json:"mixsong_type"`
|
||||
Version string `json:"version"`
|
||||
Language string `json:"language"`
|
||||
Bpm string `json:"bpm"`
|
||||
BpmType string `json:"bpm_type"`
|
||||
BpmDesc string `json:"bpm_desc"`
|
||||
PublishDate string `json:"publish_date"`
|
||||
Extname string `json:"extname"`
|
||||
AlbumInfo struct {
|
||||
AlbumID string `json:"album_id"`
|
||||
AlbumName string `json:"album_name"`
|
||||
PublishDate string `json:"publish_date"`
|
||||
Category string `json:"category"`
|
||||
IsPublish string `json:"is_publish"`
|
||||
SizableCover string `json:"sizable_cover"`
|
||||
AlbumAudioID string `json:"album_audio_id"`
|
||||
// AudioID string `json:"audio_id"`
|
||||
// AuthorName string `json:"author_name"`
|
||||
// OriAudioName string `json:"ori_audio_name"`
|
||||
// OfficialSongname string `json:"official_songname"`
|
||||
// Songname string `json:"songname"`
|
||||
// Remark string `json:"remark"`
|
||||
// SuffixAudioName string `json:"suffix_audio_name"`
|
||||
// IsSearch string `json:"is_search"`
|
||||
// IsOriginal string `json:"is_original"`
|
||||
// IsPublish string `json:"is_publish"`
|
||||
// MixsongType string `json:"mixsong_type"`
|
||||
// Version string `json:"version"`
|
||||
// Language string `json:"language"`
|
||||
// Bpm string `json:"bpm"`
|
||||
// BpmType string `json:"bpm_type"`
|
||||
// BpmDesc string `json:"bpm_desc"`
|
||||
// PublishDate string `json:"publish_date"`
|
||||
// Extname string `json:"extname"`
|
||||
AlbumInfo struct {
|
||||
AlbumID string `json:"album_id"`
|
||||
// AlbumName string `json:"album_name"`
|
||||
// PublishDate string `json:"publish_date"`
|
||||
// Category string `json:"category"`
|
||||
// IsPublish string `json:"is_publish"`
|
||||
// SizableCover string `json:"sizable_cover"`
|
||||
} `json:"album_info"`
|
||||
Classification []struct {
|
||||
Usage string `json:"usage"`
|
||||
Status string `json:"status"`
|
||||
Level string `json:"level"`
|
||||
ResType string `json:"res_type"`
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
ResID string `json:"res_id"`
|
||||
} `json:"classification"`
|
||||
// Classification []struct {
|
||||
// Usage string `json:"usage"`
|
||||
// Status string `json:"status"`
|
||||
// Level string `json:"level"`
|
||||
// ResType string `json:"res_type"`
|
||||
// Type string `json:"type"`
|
||||
// ID string `json:"id"`
|
||||
// ResID string `json:"res_id"`
|
||||
// } `json:"classification"`
|
||||
AudioInfo struct {
|
||||
IsFileHead string `json:"is_file_head"`
|
||||
IsFileHead320 string `json:"is_file_head_320"`
|
||||
AudioID string `json:"audio_id"`
|
||||
Hash string `json:"hash"`
|
||||
Filesize string `json:"filesize"`
|
||||
Timelength string `json:"timelength"`
|
||||
Bitrate string `json:"bitrate"`
|
||||
Hash128 string `json:"hash_128"`
|
||||
Filesize128 string `json:"filesize_128"`
|
||||
Timelength128 string `json:"timelength_128"`
|
||||
Hash320 string `json:"hash_320"`
|
||||
Filesize320 string `json:"filesize_320"`
|
||||
Timelength320 string `json:"timelength_320"`
|
||||
HashFlac string `json:"hash_flac"`
|
||||
FilesizeFlac string `json:"filesize_flac"`
|
||||
TimelengthFlac string `json:"timelength_flac"`
|
||||
BitrateFlac string `json:"bitrate_flac"`
|
||||
HashHigh string `json:"hash_high"`
|
||||
FilesizeHigh string `json:"filesize_high"`
|
||||
TimelengthHigh string `json:"timelength_high"`
|
||||
BitrateHigh string `json:"bitrate_high"`
|
||||
HashSuper string `json:"hash_super"`
|
||||
FilesizeSuper string `json:"filesize_super"`
|
||||
TimelengthSuper string `json:"timelength_super"`
|
||||
BitrateSuper string `json:"bitrate_super"`
|
||||
HashVinylrecord string `json:"hash_vinylrecord"`
|
||||
FilesizeVinylrecord string `json:"filesize_vinylrecord"`
|
||||
TimelengthVinylrecord string `json:"timelength_vinylrecord"`
|
||||
BitrateVinylrecord string `json:"bitrate_vinylrecord"`
|
||||
HashMultichannel string `json:"hash_multichannel"`
|
||||
FilesizeMultichannel string `json:"filesize_multichannel"`
|
||||
TimelengthMultichannel string `json:"timelength_multichannel"`
|
||||
BitrateMultichannel string `json:"bitrate_multichannel"`
|
||||
HashDolby448 string `json:"hash_dolby_448"`
|
||||
FilesizeDolby448 string `json:"filesize_dolby_448"`
|
||||
TimelengthDolby448 string `json:"timelength_dolby_448"`
|
||||
BitrateDolby448 string `json:"bitrate_dolby_448"`
|
||||
HashDolby640 string `json:"hash_dolby_640"`
|
||||
FilesizeDolby640 string `json:"filesize_dolby_640"`
|
||||
TimelengthDolby640 string `json:"timelength_dolby_640"`
|
||||
BitrateDolby640 string `json:"bitrate_dolby_640"`
|
||||
HashDolby768 string `json:"hash_dolby_768"`
|
||||
FilesizeDolby768 string `json:"filesize_dolby_768"`
|
||||
TimelengthDolby768 string `json:"timelength_dolby_768"`
|
||||
BitrateDolby768 string `json:"bitrate_dolby_768"`
|
||||
AudioGroupID string `json:"audio_group_id"`
|
||||
ExtnameSuper string `json:"extname_super"`
|
||||
Extname string `json:"extname"`
|
||||
FailProcess int `json:"fail_process"`
|
||||
PayType int `json:"pay_type"`
|
||||
Type string `json:"type"`
|
||||
OldCpy int `json:"old_cpy"`
|
||||
Privilege string `json:"privilege"`
|
||||
Privilege128 string `json:"privilege_128"`
|
||||
Privilege320 string `json:"privilege_320"`
|
||||
PrivilegeFlac string `json:"privilege_flac"`
|
||||
PrivilegeHigh string `json:"privilege_high"`
|
||||
PrivilegeSuper string `json:"privilege_super"`
|
||||
PrivilegeVinylrecord string `json:"privilege_vinylrecord"`
|
||||
PrivilegeMultichannel string `json:"privilege_multichannel"`
|
||||
PrivilegeDolby448 string `json:"privilege_dolby_448"`
|
||||
PrivilegeDolby640 string `json:"privilege_dolby_640"`
|
||||
PrivilegeDolby768 string `json:"privilege_dolby_768"`
|
||||
TransParam struct {
|
||||
HashOffset struct {
|
||||
StartByte int `json:"start_byte"`
|
||||
EndByte int `json:"end_byte"`
|
||||
StartMs int `json:"start_ms"`
|
||||
EndMs int `json:"end_ms"`
|
||||
OffsetHash string `json:"offset_hash"`
|
||||
FileType int `json:"file_type"`
|
||||
ClipHash string `json:"clip_hash"`
|
||||
} `json:"hash_offset"`
|
||||
MusicpackAdvance int `json:"musicpack_advance"`
|
||||
PayBlockTpl int `json:"pay_block_tpl"`
|
||||
Display int `json:"display"`
|
||||
DisplayRate int `json:"display_rate"`
|
||||
CpyGrade int `json:"cpy_grade"`
|
||||
CpyLevel int `json:"cpy_level"`
|
||||
Cid int `json:"cid"`
|
||||
CpyAttr0 int `json:"cpy_attr0"`
|
||||
Classmap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"classmap"`
|
||||
InitPubDay int `json:"init_pub_day"`
|
||||
Qualitymap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"qualitymap"`
|
||||
Language string `json:"language"`
|
||||
} `json:"trans_param"`
|
||||
// IsFileHead string `json:"is_file_head"`
|
||||
// IsFileHead320 string `json:"is_file_head_320"`
|
||||
// AudioID string `json:"audio_id"`
|
||||
// Hash string `json:"hash"`
|
||||
// Filesize string `json:"filesize"`
|
||||
// Timelength string `json:"timelength"`
|
||||
// Bitrate string `json:"bitrate"`
|
||||
Hash128 string `json:"hash_128"`
|
||||
// Filesize128 string `json:"filesize_128"`
|
||||
// Timelength128 string `json:"timelength_128"`
|
||||
Hash320 string `json:"hash_320"`
|
||||
// Filesize320 string `json:"filesize_320"`
|
||||
// Timelength320 string `json:"timelength_320"`
|
||||
HashFlac string `json:"hash_flac"`
|
||||
// FilesizeFlac string `json:"filesize_flac"`
|
||||
// TimelengthFlac string `json:"timelength_flac"`
|
||||
// BitrateFlac string `json:"bitrate_flac"`
|
||||
HashHigh string `json:"hash_high"`
|
||||
// FilesizeHigh string `json:"filesize_high"`
|
||||
// TimelengthHigh string `json:"timelength_high"`
|
||||
// BitrateHigh string `json:"bitrate_high"`
|
||||
HashSuper string `json:"hash_super"`
|
||||
// FilesizeSuper string `json:"filesize_super"`
|
||||
// TimelengthSuper string `json:"timelength_super"`
|
||||
// BitrateSuper string `json:"bitrate_super"`
|
||||
// HashVinylrecord string `json:"hash_vinylrecord"`
|
||||
// FilesizeVinylrecord string `json:"filesize_vinylrecord"`
|
||||
// TimelengthVinylrecord string `json:"timelength_vinylrecord"`
|
||||
// BitrateVinylrecord string `json:"bitrate_vinylrecord"`
|
||||
// HashMultichannel string `json:"hash_multichannel"`
|
||||
// FilesizeMultichannel string `json:"filesize_multichannel"`
|
||||
// TimelengthMultichannel string `json:"timelength_multichannel"`
|
||||
// BitrateMultichannel string `json:"bitrate_multichannel"`
|
||||
// HashDolby448 string `json:"hash_dolby_448"`
|
||||
// FilesizeDolby448 string `json:"filesize_dolby_448"`
|
||||
// TimelengthDolby448 string `json:"timelength_dolby_448"`
|
||||
// BitrateDolby448 string `json:"bitrate_dolby_448"`
|
||||
// HashDolby640 string `json:"hash_dolby_640"`
|
||||
// FilesizeDolby640 string `json:"filesize_dolby_640"`
|
||||
// TimelengthDolby640 string `json:"timelength_dolby_640"`
|
||||
// BitrateDolby640 string `json:"bitrate_dolby_640"`
|
||||
// HashDolby768 string `json:"hash_dolby_768"`
|
||||
// FilesizeDolby768 string `json:"filesize_dolby_768"`
|
||||
// TimelengthDolby768 string `json:"timelength_dolby_768"`
|
||||
// BitrateDolby768 string `json:"bitrate_dolby_768"`
|
||||
// AudioGroupID string `json:"audio_group_id"`
|
||||
// ExtnameSuper string `json:"extname_super"`
|
||||
// Extname string `json:"extname"`
|
||||
// FailProcess int `json:"fail_process"`
|
||||
// PayType int `json:"pay_type"`
|
||||
// Type string `json:"type"`
|
||||
// OldCpy int `json:"old_cpy"`
|
||||
// Privilege string `json:"privilege"`
|
||||
// Privilege128 string `json:"privilege_128"`
|
||||
// Privilege320 string `json:"privilege_320"`
|
||||
// PrivilegeFlac string `json:"privilege_flac"`
|
||||
// PrivilegeHigh string `json:"privilege_high"`
|
||||
// PrivilegeSuper string `json:"privilege_super"`
|
||||
// PrivilegeVinylrecord string `json:"privilege_vinylrecord"`
|
||||
// PrivilegeMultichannel string `json:"privilege_multichannel"`
|
||||
// PrivilegeDolby448 string `json:"privilege_dolby_448"`
|
||||
// PrivilegeDolby640 string `json:"privilege_dolby_640"`
|
||||
// PrivilegeDolby768 string `json:"privilege_dolby_768"`
|
||||
// TransParam struct {
|
||||
// HashOffset struct {
|
||||
// StartByte int `json:"start_byte"`
|
||||
// EndByte int `json:"end_byte"`
|
||||
// StartMs int `json:"start_ms"`
|
||||
// EndMs int `json:"end_ms"`
|
||||
// OffsetHash string `json:"offset_hash"`
|
||||
// FileType int `json:"file_type"`
|
||||
// ClipHash string `json:"clip_hash"`
|
||||
// } `json:"hash_offset"`
|
||||
// MusicpackAdvance int `json:"musicpack_advance"`
|
||||
// PayBlockTpl int `json:"pay_block_tpl"`
|
||||
// Display int `json:"display"`
|
||||
// DisplayRate int `json:"display_rate"`
|
||||
// CpyGrade int `json:"cpy_grade"`
|
||||
// CpyLevel int `json:"cpy_level"`
|
||||
// Cid int `json:"cid"`
|
||||
// CpyAttr0 int `json:"cpy_attr0"`
|
||||
// Classmap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"classmap"`
|
||||
// InitPubDay int `json:"init_pub_day"`
|
||||
// Qualitymap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"qualitymap"`
|
||||
// Language string `json:"language"`
|
||||
// } `json:"trans_param"`
|
||||
} `json:"audio_info"`
|
||||
}
|
||||
playInfo struct {
|
||||
Hash string `json:"hash"`
|
||||
Classmap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"classmap"`
|
||||
Status int `json:"status"`
|
||||
Volume float64 `json:"volume"`
|
||||
StdHashTime int `json:"std_hash_time"`
|
||||
URL []string `json:"url"`
|
||||
StdHash string `json:"std_hash"`
|
||||
TransParam struct {
|
||||
Display int `json:"display"`
|
||||
DisplayRate int `json:"display_rate"`
|
||||
} `json:"trans_param"`
|
||||
FileHead int `json:"fileHead"`
|
||||
VolumePeak float64 `json:"volume_peak"`
|
||||
BitRate int `json:"bitRate"`
|
||||
TimeLength int `json:"timeLength"`
|
||||
VolumeGain int `json:"volume_gain"`
|
||||
Q int `json:"q"`
|
||||
FileName string `json:"fileName"`
|
||||
ExtName string `json:"extName"`
|
||||
FileSize int `json:"fileSize"`
|
||||
// Hash string `json:"hash"`
|
||||
// Classmap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"classmap"`
|
||||
Status int `json:"status"`
|
||||
// Volume float64 `json:"volume"`
|
||||
// StdHashTime int `json:"std_hash_time"`
|
||||
URL []string `json:"url"`
|
||||
// StdHash string `json:"std_hash"`
|
||||
// TransParam struct {
|
||||
// Display int `json:"display"`
|
||||
// DisplayRate int `json:"display_rate"`
|
||||
// } `json:"trans_param"`
|
||||
// FileHead int `json:"fileHead"`
|
||||
// VolumePeak float64 `json:"volume_peak"`
|
||||
// BitRate int `json:"bitRate"`
|
||||
// TimeLength int `json:"timeLength"`
|
||||
// VolumeGain int `json:"volume_gain"`
|
||||
// Q int `json:"q"`
|
||||
// FileName string `json:"fileName"`
|
||||
// ExtName string `json:"extName"`
|
||||
// FileSize int `json:"fileSize"`
|
||||
}
|
||||
)
|
||||
|
||||
type rankInfo struct {
|
||||
Data struct {
|
||||
Timestamp int `json:"timestamp"`
|
||||
Total int `json:"total"`
|
||||
Info []struct {
|
||||
LastSort int `json:"last_sort"`
|
||||
Authors []struct {
|
||||
SizableAvatar string `json:"sizable_avatar"`
|
||||
IsPublish int `json:"is_publish"`
|
||||
AuthorName string `json:"author_name"`
|
||||
AuthorID int `json:"author_id"`
|
||||
} `json:"authors"`
|
||||
RankCount int `json:"rank_count"`
|
||||
RankIDPublishDate string `json:"rank_id_publish_date"`
|
||||
Songname string `json:"songname"`
|
||||
TopicURL320 string `json:"topic_url_320"`
|
||||
Sqhash string `json:"sqhash"`
|
||||
FailProcess int `json:"fail_process"`
|
||||
PayType int `json:"pay_type"`
|
||||
RecommendReason string `json:"recommend_reason"`
|
||||
RpType string `json:"rp_type"`
|
||||
AlbumID string `json:"album_id"`
|
||||
PrivilegeHigh int `json:"privilege_high"`
|
||||
TopicURLSq string `json:"topic_url_sq"`
|
||||
RankCid int `json:"rank_cid"`
|
||||
Inlist int `json:"inlist"`
|
||||
Three20Filesize int `json:"320filesize"`
|
||||
PkgPrice320 int `json:"pkg_price_320"`
|
||||
Feetype int `json:"feetype"`
|
||||
Price320 int `json:"price_320"`
|
||||
DurationHigh int `json:"duration_high"`
|
||||
FailProcess320 int `json:"fail_process_320"`
|
||||
Zone string `json:"zone"`
|
||||
TopicURL string `json:"topic_url"`
|
||||
RpPublish int `json:"rp_publish"`
|
||||
TransObj struct {
|
||||
RankShowSort int `json:"rank_show_sort"`
|
||||
} `json:"trans_obj"`
|
||||
Hash string `json:"hash"`
|
||||
Sqfilesize int `json:"sqfilesize"`
|
||||
Sqprivilege int `json:"sqprivilege"`
|
||||
PayTypeSq int `json:"pay_type_sq"`
|
||||
Bitrate int `json:"bitrate"`
|
||||
PkgPriceSq int `json:"pkg_price_sq"`
|
||||
HasAccompany int `json:"has_accompany"`
|
||||
Musical interface{} `json:"musical"`
|
||||
PayType320 int `json:"pay_type_320"`
|
||||
Issue int `json:"issue"`
|
||||
ExtnameSuper string `json:"extname_super"`
|
||||
DurationSuper int `json:"duration_super"`
|
||||
BitrateSuper int `json:"bitrate_super"`
|
||||
HashHigh string `json:"hash_high"`
|
||||
Duration int `json:"duration"`
|
||||
Three20Hash string `json:"320hash"`
|
||||
PriceSq int `json:"price_sq"`
|
||||
OldCpy int `json:"old_cpy"`
|
||||
AlbumAudioID int `json:"album_audio_id"`
|
||||
M4Afilesize int `json:"m4afilesize"`
|
||||
PkgPrice int `json:"pkg_price"`
|
||||
First int `json:"first"`
|
||||
AudioID int `json:"audio_id"`
|
||||
HashSuper string `json:"hash_super"`
|
||||
Addtime string `json:"addtime"`
|
||||
FilesizeHigh int `json:"filesize_high"`
|
||||
Price int `json:"price"`
|
||||
Privilege int `json:"privilege"`
|
||||
AlbumSizableCover string `json:"album_sizable_cover"`
|
||||
Mvdata []struct {
|
||||
Typ int `json:"typ"`
|
||||
Trk string `json:"trk"`
|
||||
Hash string `json:"hash"`
|
||||
ID string `json:"id"`
|
||||
} `json:"mvdata,omitempty"`
|
||||
Sort int `json:"sort"`
|
||||
TransParam struct {
|
||||
CpyLevel int `json:"cpy_level"`
|
||||
Classmap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"classmap"`
|
||||
CpyGrade int `json:"cpy_grade"`
|
||||
Qualitymap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"qualitymap"`
|
||||
PayBlockTpl int `json:"pay_block_tpl"`
|
||||
Cid int `json:"cid"`
|
||||
Language string `json:"language"`
|
||||
HashMultitrack string `json:"hash_multitrack"`
|
||||
CpyAttr0 int `json:"cpy_attr0"`
|
||||
Ipmap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"ipmap"`
|
||||
AppidBlock string `json:"appid_block"`
|
||||
MusicpackAdvance int `json:"musicpack_advance"`
|
||||
Display int `json:"display"`
|
||||
DisplayRate int `json:"display_rate"`
|
||||
} `json:"trans_param"`
|
||||
FilesizeSuper int `json:"filesize_super"`
|
||||
Filename string `json:"filename"`
|
||||
BitrateHigh int `json:"bitrate_high"`
|
||||
Remark string `json:"remark"`
|
||||
Extname string `json:"extname"`
|
||||
Filesize int `json:"filesize"`
|
||||
Isfirst int `json:"isfirst"`
|
||||
Mvhash string `json:"mvhash"`
|
||||
Three20Privilege int `json:"320privilege"`
|
||||
PrivilegeSuper int `json:"privilege_super"`
|
||||
FailProcessSq int `json:"fail_process_sq"`
|
||||
// Timestamp int `json:"timestamp"`
|
||||
// Total int `json:"total"`
|
||||
Info []struct {
|
||||
// LastSort int `json:"last_sort"`
|
||||
// Authors []struct {
|
||||
// SizableAvatar string `json:"sizable_avatar"`
|
||||
// IsPublish int `json:"is_publish"`
|
||||
// AuthorName string `json:"author_name"`
|
||||
// AuthorID int `json:"author_id"`
|
||||
// } `json:"authors"`
|
||||
// RankCount int `json:"rank_count"`
|
||||
// RankIDPublishDate string `json:"rank_id_publish_date"`
|
||||
// Songname string `json:"songname"`
|
||||
// TopicURL320 string `json:"topic_url_320"`
|
||||
// Sqhash string `json:"sqhash"`
|
||||
// FailProcess int `json:"fail_process"`
|
||||
// PayType int `json:"pay_type"`
|
||||
// RecommendReason string `json:"recommend_reason"`
|
||||
// RpType string `json:"rp_type"`
|
||||
// AlbumID string `json:"album_id"`
|
||||
// PrivilegeHigh int `json:"privilege_high"`
|
||||
// TopicURLSq string `json:"topic_url_sq"`
|
||||
// RankCid int `json:"rank_cid"`
|
||||
// Inlist int `json:"inlist"`
|
||||
// Three20Filesize int `json:"320filesize"`
|
||||
// PkgPrice320 int `json:"pkg_price_320"`
|
||||
// Feetype int `json:"feetype"`
|
||||
// Price320 int `json:"price_320"`
|
||||
// DurationHigh int `json:"duration_high"`
|
||||
// FailProcess320 int `json:"fail_process_320"`
|
||||
// Zone string `json:"zone"`
|
||||
// TopicURL string `json:"topic_url"`
|
||||
// RpPublish int `json:"rp_publish"`
|
||||
// TransObj struct {
|
||||
// RankShowSort int `json:"rank_show_sort"`
|
||||
// } `json:"trans_obj"`
|
||||
// Hash string `json:"hash"`
|
||||
// Sqfilesize int `json:"sqfilesize"`
|
||||
// Sqprivilege int `json:"sqprivilege"`
|
||||
// PayTypeSq int `json:"pay_type_sq"`
|
||||
// Bitrate int `json:"bitrate"`
|
||||
// PkgPriceSq int `json:"pkg_price_sq"`
|
||||
// HasAccompany int `json:"has_accompany"`
|
||||
// Musical interface{} `json:"musical"`
|
||||
// PayType320 int `json:"pay_type_320"`
|
||||
// Issue int `json:"issue"`
|
||||
// ExtnameSuper string `json:"extname_super"`
|
||||
// DurationSuper int `json:"duration_super"`
|
||||
// BitrateSuper int `json:"bitrate_super"`
|
||||
// HashHigh string `json:"hash_high"`
|
||||
// Duration int `json:"duration"`
|
||||
// Three20Hash string `json:"320hash"`
|
||||
// PriceSq int `json:"price_sq"`
|
||||
// OldCpy int `json:"old_cpy"`
|
||||
// AlbumAudioID int `json:"album_audio_id"`
|
||||
// M4Afilesize int `json:"m4afilesize"`
|
||||
// PkgPrice int `json:"pkg_price"`
|
||||
// First int `json:"first"`
|
||||
// AudioID int `json:"audio_id"`
|
||||
// HashSuper string `json:"hash_super"`
|
||||
// Addtime string `json:"addtime"`
|
||||
// FilesizeHigh int `json:"filesize_high"`
|
||||
// Price int `json:"price"`
|
||||
// Privilege int `json:"privilege"`
|
||||
// AlbumSizableCover string `json:"album_sizable_cover"`
|
||||
// Mvdata []struct {
|
||||
// Typ int `json:"typ"`
|
||||
// Trk string `json:"trk"`
|
||||
// Hash string `json:"hash"`
|
||||
// ID string `json:"id"`
|
||||
// } `json:"mvdata,omitempty"`
|
||||
// Sort int `json:"sort"`
|
||||
// TransParam struct {
|
||||
// CpyLevel int `json:"cpy_level"`
|
||||
// Classmap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"classmap"`
|
||||
// CpyGrade int `json:"cpy_grade"`
|
||||
// Qualitymap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"qualitymap"`
|
||||
// PayBlockTpl int `json:"pay_block_tpl"`
|
||||
// Cid int `json:"cid"`
|
||||
// Language string `json:"language"`
|
||||
// HashMultitrack string `json:"hash_multitrack"`
|
||||
// CpyAttr0 int `json:"cpy_attr0"`
|
||||
// Ipmap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"ipmap"`
|
||||
// AppidBlock string `json:"appid_block"`
|
||||
// MusicpackAdvance int `json:"musicpack_advance"`
|
||||
// Display int `json:"display"`
|
||||
// DisplayRate int `json:"display_rate"`
|
||||
// } `json:"trans_param"`
|
||||
// FilesizeSuper int `json:"filesize_super"`
|
||||
Filename string `json:"filename"`
|
||||
// BitrateHigh int `json:"bitrate_high"`
|
||||
// Remark string `json:"remark"`
|
||||
// Extname string `json:"extname"`
|
||||
// Filesize int `json:"filesize"`
|
||||
// Isfirst int `json:"isfirst"`
|
||||
// Mvhash string `json:"mvhash"`
|
||||
// Three20Privilege int `json:"320privilege"`
|
||||
// PrivilegeSuper int `json:"privilege_super"`
|
||||
// FailProcessSq int `json:"fail_process_sq"`
|
||||
} `json:"info"`
|
||||
} `json:"data"`
|
||||
Errcode int `json:"errcode"`
|
||||
Status int `json:"status"`
|
||||
Error string `json:"error"`
|
||||
// Errcode int `json:"errcode"`
|
||||
Status int `json:"status"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
type searchInfo struct {
|
||||
Data struct {
|
||||
AlgPath string `json:"AlgPath"`
|
||||
Aggregation struct {
|
||||
} `json:"aggregation"`
|
||||
Allowerr int `json:"allowerr"`
|
||||
Chinesecount int `json:"chinesecount"`
|
||||
Correctionforce int `json:"correctionforce"`
|
||||
Correctionrelate string `json:"correctionrelate"`
|
||||
Correctionsubject string `json:"correctionsubject"`
|
||||
Correctiontip string `json:"correctiontip"`
|
||||
Correctiontype int `json:"correctiontype"`
|
||||
From int `json:"from"`
|
||||
Isshareresult int `json:"isshareresult"`
|
||||
Istag int `json:"istag"`
|
||||
Istagresult int `json:"istagresult"`
|
||||
Lists []struct {
|
||||
A320Privilege int `json:"A320Privilege"`
|
||||
ASQPrivilege int `json:"ASQPrivilege"`
|
||||
Accompany int `json:"Accompany"`
|
||||
AlbumAux string `json:"AlbumAux"`
|
||||
AlbumID string `json:"AlbumID"`
|
||||
AlbumName string `json:"AlbumName"`
|
||||
AlbumPrivilege int `json:"AlbumPrivilege"`
|
||||
AudioCdn int `json:"AudioCdn"`
|
||||
Audioid int `json:"Audioid"`
|
||||
Auxiliary string `json:"Auxiliary"`
|
||||
Bitrate int `json:"Bitrate"`
|
||||
Category int `json:"Category"`
|
||||
Duration int `json:"Duration"`
|
||||
ExtName string `json:"ExtName"`
|
||||
FailProcess int `json:"FailProcess"`
|
||||
FileHash string `json:"FileHash"`
|
||||
FileName string `json:"FileName"`
|
||||
FileSize int `json:"FileSize"`
|
||||
FoldType int `json:"FoldType"`
|
||||
Grp []interface{} `json:"Grp"`
|
||||
HQBitrate int `json:"HQBitrate"`
|
||||
HQDuration int `json:"HQDuration"`
|
||||
HQExtName string `json:"HQExtName"`
|
||||
HQFailProcess int `json:"HQFailProcess"`
|
||||
HQFileHash string `json:"HQFileHash"`
|
||||
HQFileSize int `json:"HQFileSize"`
|
||||
HQPayType int `json:"HQPayType"`
|
||||
HQPkgPrice int `json:"HQPkgPrice"`
|
||||
HQPrice int `json:"HQPrice"`
|
||||
HQPrivilege int `json:"HQPrivilege"`
|
||||
HasAlbum int `json:"HasAlbum"`
|
||||
HeatLevel int `json:"HeatLevel"`
|
||||
HiFiQuality int `json:"HiFiQuality"`
|
||||
ID string `json:"ID"`
|
||||
Image string `json:"Image"`
|
||||
IsOriginal int `json:"IsOriginal"`
|
||||
M4ASize int `json:"M4aSize"`
|
||||
MatchFlag int `json:"MatchFlag"`
|
||||
MixSongID string `json:"MixSongID"`
|
||||
MvHash string `json:"MvHash"`
|
||||
MvTrac int `json:"MvTrac"`
|
||||
MvType int `json:"MvType"`
|
||||
OldCpy int `json:"OldCpy"`
|
||||
OriOtherName string `json:"OriOtherName"`
|
||||
OriSongName string `json:"OriSongName"`
|
||||
OtherName string `json:"OtherName"`
|
||||
OwnerCount int `json:"OwnerCount"`
|
||||
PayType int `json:"PayType"`
|
||||
PkgPrice int `json:"PkgPrice"`
|
||||
Price int `json:"Price"`
|
||||
Privilege int `json:"Privilege"`
|
||||
Publish int `json:"Publish"`
|
||||
PublishAge int `json:"PublishAge"`
|
||||
PublishTime string `json:"PublishTime"`
|
||||
QualityLevel int `json:"QualityLevel"`
|
||||
RankID int `json:"RankId"`
|
||||
Res struct {
|
||||
FailProcess int `json:"FailProcess"`
|
||||
PayType int `json:"PayType"`
|
||||
PkgPrice int `json:"PkgPrice"`
|
||||
Price int `json:"Price"`
|
||||
Privilege int `json:"Privilege"`
|
||||
} `json:"Res"`
|
||||
ResBitrate int `json:"ResBitrate"`
|
||||
ResDuration int `json:"ResDuration"`
|
||||
ResFileHash string `json:"ResFileHash"`
|
||||
ResFileSize int `json:"ResFileSize"`
|
||||
SQBitrate int `json:"SQBitrate"`
|
||||
SQDuration int `json:"SQDuration"`
|
||||
SQExtName string `json:"SQExtName"`
|
||||
SQFailProcess int `json:"SQFailProcess"`
|
||||
SQFileHash string `json:"SQFileHash"`
|
||||
SQFileSize int `json:"SQFileSize"`
|
||||
SQPayType int `json:"SQPayType"`
|
||||
SQPkgPrice int `json:"SQPkgPrice"`
|
||||
SQPrice int `json:"SQPrice"`
|
||||
SQPrivilege int `json:"SQPrivilege"`
|
||||
Scid int `json:"Scid"`
|
||||
ShowingFlag int `json:"ShowingFlag"`
|
||||
SingerID []int `json:"SingerId"`
|
||||
SingerName string `json:"SingerName"`
|
||||
Singers []struct {
|
||||
ID int `json:"id"`
|
||||
IPID int `json:"ip_id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"Singers"`
|
||||
SongLabel string `json:"SongLabel"`
|
||||
SongName string `json:"SongName"`
|
||||
Source string `json:"Source"`
|
||||
SourceID int `json:"SourceID"`
|
||||
Suffix string `json:"Suffix"`
|
||||
SuperBitrate int `json:"SuperBitrate"`
|
||||
SuperDuration int `json:"SuperDuration"`
|
||||
SuperExtName string `json:"SuperExtName"`
|
||||
SuperFileHash string `json:"SuperFileHash"`
|
||||
SuperFileSize int `json:"SuperFileSize"`
|
||||
TagContent string `json:"TagContent"`
|
||||
TagDetails []struct {
|
||||
Content string `json:"content"`
|
||||
Rankid int `json:"rankid"`
|
||||
Type int `json:"type"`
|
||||
Version int `json:"version"`
|
||||
} `json:"TagDetails"`
|
||||
TopID int `json:"TopID"`
|
||||
TopicRemark string `json:"TopicRemark"`
|
||||
TopicURL string `json:"TopicUrl"`
|
||||
Type string `json:"Type"`
|
||||
Uploader string `json:"Uploader"`
|
||||
UploaderContent string `json:"UploaderContent"`
|
||||
MvTotal int `json:"mvTotal"`
|
||||
Mvdata []struct {
|
||||
Hash string `json:"hash"`
|
||||
ID string `json:"id"`
|
||||
Trk string `json:"trk"`
|
||||
Typ int `json:"typ"`
|
||||
} `json:"mvdata"`
|
||||
RecommendType int `json:"recommend_type"`
|
||||
TransParam struct {
|
||||
AppidBlock string `json:"appid_block"`
|
||||
Cid int `json:"cid"`
|
||||
Classmap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"classmap"`
|
||||
CpyAttr0 int `json:"cpy_attr0"`
|
||||
CpyGrade int `json:"cpy_grade"`
|
||||
CpyLevel int `json:"cpy_level"`
|
||||
Display int `json:"display"`
|
||||
DisplayRate int `json:"display_rate"`
|
||||
HashMultitrack string `json:"hash_multitrack"`
|
||||
Ipmap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"ipmap"`
|
||||
Language string `json:"language"`
|
||||
MusicpackAdvance int `json:"musicpack_advance"`
|
||||
PayBlockTpl int `json:"pay_block_tpl"`
|
||||
Qualitymap struct {
|
||||
Attr0 int `json:"attr0"`
|
||||
} `json:"qualitymap"`
|
||||
SongnameSuffix string `json:"songname_suffix"`
|
||||
} `json:"trans_param"`
|
||||
Vvid string `json:"vvid"`
|
||||
// AlgPath string `json:"AlgPath"`
|
||||
// Aggregation struct {
|
||||
// } `json:"aggregation"`
|
||||
// Allowerr int `json:"allowerr"`
|
||||
// Chinesecount int `json:"chinesecount"`
|
||||
// Correctionforce int `json:"correctionforce"`
|
||||
// Correctionrelate string `json:"correctionrelate"`
|
||||
// Correctionsubject string `json:"correctionsubject"`
|
||||
// Correctiontip string `json:"correctiontip"`
|
||||
// Correctiontype int `json:"correctiontype"`
|
||||
// From int `json:"from"`
|
||||
// Isshareresult int `json:"isshareresult"`
|
||||
// Istag int `json:"istag"`
|
||||
// Istagresult int `json:"istagresult"`
|
||||
Lists []struct {
|
||||
// A320Privilege int `json:"A320Privilege"`
|
||||
// ASQPrivilege int `json:"ASQPrivilege"`
|
||||
// Accompany int `json:"Accompany"`
|
||||
// AlbumAux string `json:"AlbumAux"`
|
||||
// AlbumID string `json:"AlbumID"`
|
||||
// AlbumName string `json:"AlbumName"`
|
||||
// AlbumPrivilege int `json:"AlbumPrivilege"`
|
||||
// AudioCdn int `json:"AudioCdn"`
|
||||
// Audioid int `json:"Audioid"`
|
||||
// Auxiliary string `json:"Auxiliary"`
|
||||
// Bitrate int `json:"Bitrate"`
|
||||
// Category int `json:"Category"`
|
||||
// Duration int `json:"Duration"`
|
||||
// ExtName string `json:"ExtName"`
|
||||
// FailProcess int `json:"FailProcess"`
|
||||
// FileHash string `json:"FileHash"`
|
||||
// FileName string `json:"FileName"`
|
||||
// FileSize int `json:"FileSize"`
|
||||
// FoldType int `json:"FoldType"`
|
||||
// Grp []interface{} `json:"Grp"`
|
||||
// HQBitrate int `json:"HQBitrate"`
|
||||
// HQDuration int `json:"HQDuration"`
|
||||
// HQExtName string `json:"HQExtName"`
|
||||
// HQFailProcess int `json:"HQFailProcess"`
|
||||
// HQFileHash string `json:"HQFileHash"`
|
||||
// HQFileSize int `json:"HQFileSize"`
|
||||
// HQPayType int `json:"HQPayType"`
|
||||
// HQPkgPrice int `json:"HQPkgPrice"`
|
||||
// HQPrice int `json:"HQPrice"`
|
||||
// HQPrivilege int `json:"HQPrivilege"`
|
||||
// HasAlbum int `json:"HasAlbum"`
|
||||
// HeatLevel int `json:"HeatLevel"`
|
||||
// HiFiQuality int `json:"HiFiQuality"`
|
||||
// ID string `json:"ID"`
|
||||
// Image string `json:"Image"`
|
||||
// IsOriginal int `json:"IsOriginal"`
|
||||
// M4ASize int `json:"M4aSize"`
|
||||
// MatchFlag int `json:"MatchFlag"`
|
||||
MixSongID string `json:"MixSongID"`
|
||||
// MvHash string `json:"MvHash"`
|
||||
// MvTrac int `json:"MvTrac"`
|
||||
// MvType int `json:"MvType"`
|
||||
// OldCpy int `json:"OldCpy"`
|
||||
// OriOtherName string `json:"OriOtherName"`
|
||||
// OriSongName string `json:"OriSongName"`
|
||||
// OtherName string `json:"OtherName"`
|
||||
// OwnerCount int `json:"OwnerCount"`
|
||||
// PayType int `json:"PayType"`
|
||||
// PkgPrice int `json:"PkgPrice"`
|
||||
// Price int `json:"Price"`
|
||||
// Privilege int `json:"Privilege"`
|
||||
// Publish int `json:"Publish"`
|
||||
// PublishAge int `json:"PublishAge"`
|
||||
// PublishTime string `json:"PublishTime"`
|
||||
// QualityLevel int `json:"QualityLevel"`
|
||||
// RankID int `json:"RankId"`
|
||||
// Res struct {
|
||||
// FailProcess int `json:"FailProcess"`
|
||||
// PayType int `json:"PayType"`
|
||||
// PkgPrice int `json:"PkgPrice"`
|
||||
// Price int `json:"Price"`
|
||||
// Privilege int `json:"Privilege"`
|
||||
// } `json:"Res"`
|
||||
// ResBitrate int `json:"ResBitrate"`
|
||||
// ResDuration int `json:"ResDuration"`
|
||||
// ResFileHash string `json:"ResFileHash"`
|
||||
// ResFileSize int `json:"ResFileSize"`
|
||||
// SQBitrate int `json:"SQBitrate"`
|
||||
// SQDuration int `json:"SQDuration"`
|
||||
// SQExtName string `json:"SQExtName"`
|
||||
// SQFailProcess int `json:"SQFailProcess"`
|
||||
// SQFileHash string `json:"SQFileHash"`
|
||||
// SQFileSize int `json:"SQFileSize"`
|
||||
// SQPayType int `json:"SQPayType"`
|
||||
// SQPkgPrice int `json:"SQPkgPrice"`
|
||||
// SQPrice int `json:"SQPrice"`
|
||||
// SQPrivilege int `json:"SQPrivilege"`
|
||||
// Scid int `json:"Scid"`
|
||||
// ShowingFlag int `json:"ShowingFlag"`
|
||||
// SingerID []int `json:"SingerId"`
|
||||
// SingerName string `json:"SingerName"`
|
||||
// Singers []struct {
|
||||
// ID int `json:"id"`
|
||||
// IPID int `json:"ip_id"`
|
||||
// Name string `json:"name"`
|
||||
// } `json:"Singers"`
|
||||
// SongLabel string `json:"SongLabel"`
|
||||
// SongName string `json:"SongName"`
|
||||
// Source string `json:"Source"`
|
||||
// SourceID int `json:"SourceID"`
|
||||
// Suffix string `json:"Suffix"`
|
||||
// SuperBitrate int `json:"SuperBitrate"`
|
||||
// SuperDuration int `json:"SuperDuration"`
|
||||
// SuperExtName string `json:"SuperExtName"`
|
||||
// SuperFileHash string `json:"SuperFileHash"`
|
||||
// SuperFileSize int `json:"SuperFileSize"`
|
||||
// TagContent string `json:"TagContent"`
|
||||
// TagDetails []struct {
|
||||
// Content string `json:"content"`
|
||||
// Rankid int `json:"rankid"`
|
||||
// Type int `json:"type"`
|
||||
// Version int `json:"version"`
|
||||
// } `json:"TagDetails"`
|
||||
// TopID int `json:"TopID"`
|
||||
// TopicRemark string `json:"TopicRemark"`
|
||||
// TopicURL string `json:"TopicUrl"`
|
||||
// Type string `json:"Type"`
|
||||
// Uploader string `json:"Uploader"`
|
||||
// UploaderContent string `json:"UploaderContent"`
|
||||
// MvTotal int `json:"mvTotal"`
|
||||
// Mvdata []struct {
|
||||
// Hash string `json:"hash"`
|
||||
// ID string `json:"id"`
|
||||
// Trk string `json:"trk"`
|
||||
// Typ int `json:"typ"`
|
||||
// } `json:"mvdata"`
|
||||
// RecommendType int `json:"recommend_type"`
|
||||
// TransParam struct {
|
||||
// AppidBlock string `json:"appid_block"`
|
||||
// Cid int `json:"cid"`
|
||||
// Classmap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"classmap"`
|
||||
// CpyAttr0 int `json:"cpy_attr0"`
|
||||
// CpyGrade int `json:"cpy_grade"`
|
||||
// CpyLevel int `json:"cpy_level"`
|
||||
// Display int `json:"display"`
|
||||
// DisplayRate int `json:"display_rate"`
|
||||
// HashMultitrack string `json:"hash_multitrack"`
|
||||
// Ipmap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"ipmap"`
|
||||
// Language string `json:"language"`
|
||||
// MusicpackAdvance int `json:"musicpack_advance"`
|
||||
// PayBlockTpl int `json:"pay_block_tpl"`
|
||||
// Qualitymap struct {
|
||||
// Attr0 int `json:"attr0"`
|
||||
// } `json:"qualitymap"`
|
||||
// SongnameSuffix string `json:"songname_suffix"`
|
||||
// } `json:"trans_param"`
|
||||
// Vvid string `json:"vvid"`
|
||||
} `json:"lists"`
|
||||
Page int `json:"page"`
|
||||
Pagesize int `json:"pagesize"`
|
||||
Searchfull int `json:"searchfull"`
|
||||
SecAggre struct {
|
||||
} `json:"sec_aggre"`
|
||||
SecAggreV2 []interface{} `json:"sec_aggre_v2"`
|
||||
SectagInfo struct {
|
||||
IsSectag int `json:"is_sectag"`
|
||||
} `json:"sectag_info"`
|
||||
Size int `json:"size"`
|
||||
Subjecttype int `json:"subjecttype"`
|
||||
Total int `json:"total"`
|
||||
// Page int `json:"page"`
|
||||
// Pagesize int `json:"pagesize"`
|
||||
// Searchfull int `json:"searchfull"`
|
||||
// SecAggre struct {
|
||||
// } `json:"sec_aggre"`
|
||||
// SecAggreV2 []interface{} `json:"sec_aggre_v2"`
|
||||
// SectagInfo struct {
|
||||
// IsSectag int `json:"is_sectag"`
|
||||
// } `json:"sectag_info"`
|
||||
// Size int `json:"size"`
|
||||
// Subjecttype int `json:"subjecttype"`
|
||||
Total int `json:"total"`
|
||||
} `json:"data"`
|
||||
ErrorCode int `json:"error_code"`
|
||||
ErrorMsg string `json:"error_msg"`
|
||||
Status int `json:"status"`
|
||||
// ErrorCode int `json:"error_code"`
|
||||
ErrorMsg string `json:"error_msg"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
type refreshInfo struct {
|
||||
Data string `json:"data"`
|
||||
// Data string `json:"data"`
|
||||
ErrorCode int `json:"error_code"`
|
||||
ErrorMsg string `json:"error_msg"`
|
||||
Status int `json:"status"`
|
||||
|
@ -79,7 +79,7 @@ func bdapi(songMid, quality string) (ourl, msg string) {
|
||||
`https://bd-api.kuwo.cn/api/service/music/downloadInfo/`, songMid,
|
||||
`?isMv=0&format=`, info.E,
|
||||
`&br=`, info.H, info.E, //`&level=`,
|
||||
`&uin=`, env.Config.Custom.Kw_Bd_Uid,
|
||||
`&uid=`, env.Config.Custom.Kw_Bd_Uid,
|
||||
`&token=`, env.Config.Custom.Kw_Bd_Token,
|
||||
)
|
||||
// jx.Debug(`Kw, Url: %s`, url)
|
||||
|
41
src/sources/custom/mg/albuminfo.go
Normal file
41
src/sources/custom/mg/albuminfo.go
Normal file
@ -0,0 +1,41 @@
|
||||
package mg
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"errors"
|
||||
"lx-source/src/env"
|
||||
"lx-source/src/sources"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(albumInfo{})
|
||||
}
|
||||
|
||||
func getAlbumInfo(aid string) (info albumInfo, err error) {
|
||||
cquery := strings.Join([]string{`mg`, aid, `ainfo`}, `/`)
|
||||
if cdata, ok := env.Cache.Get(cquery); ok {
|
||||
if cinfo, ok := cdata.(albumInfo); ok {
|
||||
info = cinfo
|
||||
return
|
||||
}
|
||||
}
|
||||
err = ztool.Net_Request(
|
||||
http.MethodGet, ztool.Str_FastConcat(
|
||||
`https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?needSimple=01&resourceId=`, aid, `&resourceType=2003`,
|
||||
), nil,
|
||||
[]ztool.Net_ReqHandlerFunc{ztool.Net_ReqAddHeaders()},
|
||||
[]ztool.Net_ResHandlerFunc{ztool.Net_ResToStruct(&info)},
|
||||
)
|
||||
if err == nil {
|
||||
if len(info.Resource) == 0 {
|
||||
err = errors.New(`no Album Resource`)
|
||||
} else {
|
||||
env.Cache.Set(cquery, info, sources.C_lx)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
41
src/sources/custom/mg/musicinfo.go
Normal file
41
src/sources/custom/mg/musicinfo.go
Normal file
@ -0,0 +1,41 @@
|
||||
package mg
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"errors"
|
||||
"lx-source/src/env"
|
||||
"lx-source/src/sources"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(musicInfo{})
|
||||
}
|
||||
|
||||
func getMusicInfo(cid string) (info musicInfo, err error) {
|
||||
cquery := strings.Join([]string{`mg`, cid, `minfo`}, `/`)
|
||||
if cdata, ok := env.Cache.Get(cquery); ok {
|
||||
if cinfo, ok := cdata.(musicInfo); ok {
|
||||
info = cinfo
|
||||
return
|
||||
}
|
||||
}
|
||||
err = ztool.Net_Request(
|
||||
http.MethodGet, ztool.Str_FastConcat(
|
||||
`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?copyrightId=`, cid, `&resourceType=2`,
|
||||
), nil,
|
||||
[]ztool.Net_ReqHandlerFunc{ztool.Net_ReqAddHeaders()},
|
||||
[]ztool.Net_ResHandlerFunc{ztool.Net_ResToStruct(&info)},
|
||||
)
|
||||
if err == nil {
|
||||
if len(info.Resource) == 0 {
|
||||
err = errors.New(`no Music Resource`)
|
||||
} else {
|
||||
env.Cache.Set(cquery, info, sources.C_lx)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
@ -37,6 +37,9 @@ func init() {
|
||||
}
|
||||
mg_pool = &sync.Pool{New: func() any { return new(playInfo) }}
|
||||
Url = mcustom
|
||||
case `2`, `malbum`:
|
||||
loger.Debug(`use malbum`)
|
||||
Url = malbum
|
||||
default:
|
||||
loger.Fatal(`未定义的接口模式,请检查配置 [Custom].Mg_Mode`)
|
||||
}
|
||||
@ -46,12 +49,12 @@ func init() {
|
||||
|
||||
func builtin(songMid, quality string) (ourl, msg string) {
|
||||
loger := env.Loger.NewGroup(`Mg`)
|
||||
defer loger.Free()
|
||||
rquality, ok := qualitys[quality]
|
||||
if !ok {
|
||||
msg = sources.E_QNotSupport
|
||||
return
|
||||
}
|
||||
defer loger.Free()
|
||||
resp := mg_pool.Get().(*mgApi_Song)
|
||||
defer mg_pool.Put(resp)
|
||||
url := ztool.Str_FastConcat(`https://`, example.Api_mg, `?copyrightId=`, songMid, `&type=`, rquality)
|
||||
@ -66,6 +69,7 @@ func builtin(songMid, quality string) (ourl, msg string) {
|
||||
return
|
||||
}
|
||||
loger.Debug(`Resp: %+v`, resp)
|
||||
// ourl, msg = resp.Url(rquality)
|
||||
if resp.Data.PlayURL != `` {
|
||||
ourl = `https:` + utils.DelQuery(resp.Data.PlayURL)
|
||||
} else {
|
||||
@ -126,3 +130,56 @@ func mcustom(songMid, quality string) (ourl, msg string) {
|
||||
ourl = utils.DelQuery(resp.Data.URL)
|
||||
return
|
||||
}
|
||||
|
||||
func malbum(songMid, quality string) (ourl, msg string) {
|
||||
loger := env.Loger.NewGroup(`Mg`)
|
||||
defer loger.Free()
|
||||
rquality, ok := qualityMap[quality]
|
||||
if !ok {
|
||||
msg = sources.E_QNotSupport
|
||||
return
|
||||
}
|
||||
minfo, err := getMusicInfo(songMid)
|
||||
if err != nil {
|
||||
msg = err.Error()
|
||||
return
|
||||
}
|
||||
loger.Debug(`mInfo: %+v`, minfo)
|
||||
var hasQuality bool
|
||||
for _, v := range minfo.Resource[0].NewRateFormats {
|
||||
if hasQuality = v.FormatType == rquality; hasQuality {
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasQuality {
|
||||
msg = sources.E_QNotMatch
|
||||
return
|
||||
}
|
||||
ainfo, err := getAlbumInfo(minfo.Resource[0].AlbumID)
|
||||
if err != nil {
|
||||
msg = err.Error()
|
||||
return
|
||||
}
|
||||
loger.Debug(`aInfo: %+v`, ainfo)
|
||||
for _, v := range ainfo.Resource[0].SongItems {
|
||||
if v.CopyrightID == songMid {
|
||||
for _, w := range v.NewRateFormats {
|
||||
if w.FormatType == rquality {
|
||||
if rquality == `PQ` || rquality == `HQ` {
|
||||
ourl = w.URL
|
||||
} else {
|
||||
ourl = w.AndroidURL
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if ourl == `` {
|
||||
msg = sources.E_NoLink
|
||||
} else {
|
||||
ourl = `https://freetyst.nf.migu.cn` + ourl[24:]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
37
src/sources/custom/mg/refresh.go
Normal file
37
src/sources/custom/mg/refresh.go
Normal file
@ -0,0 +1,37 @@
|
||||
package mg
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"lx-source/src/env"
|
||||
"net/http"
|
||||
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
"github.com/ZxwyWebSite/ztool/logs"
|
||||
)
|
||||
|
||||
func refresh(loger *logs.Logger, now int64) error {
|
||||
var out map[string]any
|
||||
err := ztool.Net_Request(
|
||||
http.MethodPost,
|
||||
`https://m.music.migu.cn/migumusic/h5/user/auth/userActiveNotice`,
|
||||
nil,
|
||||
[]ztool.Net_ReqHandlerFunc{ztool.Net_ReqAddHeaders(mgheader)},
|
||||
[]ztool.Net_ResHandlerFunc{ztool.Net_ResToStruct(&out)},
|
||||
)
|
||||
if err == nil {
|
||||
if out[`code`].(int) != http.StatusOK {
|
||||
return errors.New(out[`msg`].(string))
|
||||
} else {
|
||||
loger.Info(`咪咕session保活成功`)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func init() {
|
||||
env.Inits.Add(func() {
|
||||
if env.Config.Custom.Mg_Refresh_Enable && false {
|
||||
env.Tasker.Add(`mg_refresh`, refresh, 86000, true)
|
||||
}
|
||||
})
|
||||
}
|
@ -43,6 +43,25 @@ type playInfo struct {
|
||||
Info string `json:"info"`
|
||||
}
|
||||
|
||||
// func (resp *playInfo) Url(rquality string) (ourl, emsg string) {
|
||||
// if resp.Code != `000000` {
|
||||
// emsg = resp.Info
|
||||
// return
|
||||
// }
|
||||
// if resp.Data.URL == `` {
|
||||
// emsg = `No Data: 无返回链接`
|
||||
// return
|
||||
// }
|
||||
// if resp.Data.AudioFormatType != rquality {
|
||||
// emsg = ztool.Str_FastConcat(`实际音质不匹配: `, rquality, ` <= `, resp.Data.AudioFormatType)
|
||||
// if !env.Config.Source.ForceFallback {
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// ourl = utils.DelQuery(resp.Data.URL)
|
||||
// return
|
||||
// }
|
||||
|
||||
type mgApi_Song struct {
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
@ -55,3 +74,460 @@ type mgApi_Song struct {
|
||||
AuditionsLength int `json:"auditionsLength"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
// func (resp *mgApi_Song) Url(string) (ourl, emsg string) {
|
||||
// if resp.Data.PlayURL != `` {
|
||||
// ourl = `https:` + utils.DelQuery(resp.Data.PlayURL)
|
||||
// } else {
|
||||
// emsg = ztool.Str_FastConcat(resp.Code, `: `, resp.Msg)
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
type musicInfo struct {
|
||||
// Code string `json:"code"`
|
||||
// Info string `json:"info"`
|
||||
Resource []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// RefID string `json:"refId"`
|
||||
// CopyrightID string `json:"copyrightId"`
|
||||
// ContentID string `json:"contentId"`
|
||||
// SongID string `json:"songId"`
|
||||
// SongName string `json:"songName"`
|
||||
// SingerID string `json:"singerId"`
|
||||
// Singer string `json:"singer"`
|
||||
AlbumID string `json:"albumId"`
|
||||
// Album string `json:"album"`
|
||||
// AlbumImgs []struct {
|
||||
// ImgSizeType string `json:"imgSizeType"`
|
||||
// Img string `json:"img"`
|
||||
// FileID string `json:"fileId"`
|
||||
// WebpImg string `json:"webpImg"`
|
||||
// } `json:"albumImgs"`
|
||||
// OpNumItem struct {
|
||||
// PlayNum int `json:"playNum"`
|
||||
// PlayNumDesc string `json:"playNumDesc"`
|
||||
// KeepNum int `json:"keepNum"`
|
||||
// KeepNumDesc string `json:"keepNumDesc"`
|
||||
// CommentNum int `json:"commentNum"`
|
||||
// CommentNumDesc string `json:"commentNumDesc"`
|
||||
// ShareNum int `json:"shareNum"`
|
||||
// ShareNumDesc string `json:"shareNumDesc"`
|
||||
// OrderNumByWeek int `json:"orderNumByWeek"`
|
||||
// OrderNumByWeekDesc string `json:"orderNumByWeekDesc"`
|
||||
// OrderNumByTotal int `json:"orderNumByTotal"`
|
||||
// OrderNumByTotalDesc string `json:"orderNumByTotalDesc"`
|
||||
// ThumbNum int `json:"thumbNum"`
|
||||
// ThumbNumDesc string `json:"thumbNumDesc"`
|
||||
// FollowNum int `json:"followNum"`
|
||||
// FollowNumDesc string `json:"followNumDesc"`
|
||||
// SubscribeNum int `json:"subscribeNum"`
|
||||
// SubscribeNumDesc string `json:"subscribeNumDesc"`
|
||||
// LivePlayNum int `json:"livePlayNum"`
|
||||
// LivePlayNumDesc string `json:"livePlayNumDesc"`
|
||||
// PopularNum int `json:"popularNum"`
|
||||
// PopularNumDesc string `json:"popularNumDesc"`
|
||||
// BookingNum int `json:"bookingNum"`
|
||||
// BookingNumDesc string `json:"bookingNumDesc"`
|
||||
// SettingNum int `json:"settingNum"`
|
||||
// SettingNumDesc string `json:"settingNumDesc"`
|
||||
// CallNum int `json:"callNum"`
|
||||
// CallNumDesc string `json:"callNumDesc"`
|
||||
// CallingPlayNum int `json:"callingPlayNum"`
|
||||
// CallingPlayNumDesc string `json:"callingPlayNumDesc"`
|
||||
// CallingPlayDuration int `json:"callingPlayDuration"`
|
||||
// CallingPlayDurationDesc string `json:"callingPlayDurationDesc"`
|
||||
// CalledPlayDuration int `json:"calledPlayDuration"`
|
||||
// CalledPlayDurationDesc string `json:"calledPlayDurationDesc"`
|
||||
// RingtoneAppPlayNum int `json:"ringtoneAppPlayNum"`
|
||||
// RingtoneAppPlayNumDesc string `json:"ringtoneAppPlayNumDesc"`
|
||||
// RingtoneAppSettingNum int `json:"ringtoneAppSettingNum"`
|
||||
// RingtoneAppSettingNumDesc string `json:"ringtoneAppSettingNumDesc"`
|
||||
// } `json:"opNumItem"`
|
||||
// ToneControl string `json:"toneControl"`
|
||||
// RelatedSongs []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// ResourceTypeName string `json:"resourceTypeName"`
|
||||
// CopyrightID string `json:"copyrightId"`
|
||||
// ProductID string `json:"productId"`
|
||||
// } `json:"relatedSongs"`
|
||||
// RateFormats []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// FormatType string `json:"formatType"`
|
||||
// Format string `json:"format"`
|
||||
// Size string `json:"size"`
|
||||
// FileType string `json:"fileType,omitempty"`
|
||||
// Price string `json:"price"`
|
||||
// AndroidFileType string `json:"androidFileType,omitempty"`
|
||||
// IosFileType string `json:"iosFileType,omitempty"`
|
||||
// IosSize string `json:"iosSize,omitempty"`
|
||||
// AndroidSize string `json:"androidSize,omitempty"`
|
||||
// IosFormat string `json:"iosFormat,omitempty"`
|
||||
// AndroidFormat string `json:"androidFormat,omitempty"`
|
||||
// IosAccuracyLevel string `json:"iosAccuracyLevel,omitempty"`
|
||||
// AndroidAccuracyLevel string `json:"androidAccuracyLevel,omitempty"`
|
||||
// } `json:"rateFormats"`
|
||||
NewRateFormats []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
FormatType string `json:"formatType"`
|
||||
// Format string `json:"format"`
|
||||
// Size string `json:"size"`
|
||||
// FileType string `json:"fileType,omitempty"`
|
||||
// Price string `json:"price"`
|
||||
// AndroidFileType string `json:"androidFileType,omitempty"`
|
||||
// IosFileType string `json:"iosFileType,omitempty"`
|
||||
// IosSize string `json:"iosSize,omitempty"`
|
||||
// AndroidSize string `json:"androidSize,omitempty"`
|
||||
// IosFormat string `json:"iosFormat,omitempty"`
|
||||
// AndroidFormat string `json:"androidFormat,omitempty"`
|
||||
// IosAccuracyLevel string `json:"iosAccuracyLevel,omitempty"`
|
||||
// AndroidAccuracyLevel string `json:"androidAccuracyLevel,omitempty"`
|
||||
} `json:"newRateFormats"`
|
||||
// LrcURL string `json:"lrcUrl"`
|
||||
// TagList []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// TagID string `json:"tagId"`
|
||||
// TagName string `json:"tagName"`
|
||||
// TagDesc string `json:"tagDesc,omitempty"`
|
||||
// } `json:"tagList"`
|
||||
// DigitalColumnID string `json:"digitalColumnId"`
|
||||
// Copyright string `json:"copyright"`
|
||||
// ValidStatus bool `json:"validStatus"`
|
||||
// SongDescs string `json:"songDescs"`
|
||||
// SongAliasName string `json:"songAliasName"`
|
||||
// IsInDAlbum string `json:"isInDAlbum"`
|
||||
// IsInSideDalbum string `json:"isInSideDalbum"`
|
||||
// IsInSalesPeriod string `json:"isInSalesPeriod"`
|
||||
// SongType string `json:"songType"`
|
||||
// MrcURL string `json:"mrcUrl"`
|
||||
// InvalidateDate string `json:"invalidateDate"`
|
||||
// DalbumID string `json:"dalbumId"`
|
||||
// TrcURL string `json:"trcUrl"`
|
||||
// VipType string `json:"vipType"`
|
||||
// ScopeOfcopyright string `json:"scopeOfcopyright"`
|
||||
// AuditionsType string `json:"auditionsType"`
|
||||
// FirstIcon string `json:"firstIcon"`
|
||||
// TranslateName string `json:"translateName"`
|
||||
// ChargeAuditions string `json:"chargeAuditions"`
|
||||
// OldChargeAuditions string `json:"oldChargeAuditions"`
|
||||
// SongIcon string `json:"songIcon"`
|
||||
// CodeRate struct {
|
||||
// PQ struct {
|
||||
// CodeRateChargeAuditions string `json:"codeRateChargeAuditions"`
|
||||
// IsCodeRateDownload string `json:"isCodeRateDownload"`
|
||||
// CodeRateFileSize string `json:"codeRateFileSize"`
|
||||
// } `json:"PQ"`
|
||||
// HQ struct {
|
||||
// CodeRateChargeAuditions string `json:"codeRateChargeAuditions"`
|
||||
// IsCodeRateDownload string `json:"isCodeRateDownload"`
|
||||
// } `json:"HQ"`
|
||||
// SQ struct {
|
||||
// CodeRateChargeAuditions string `json:"codeRateChargeAuditions"`
|
||||
// IsCodeRateDownload string `json:"isCodeRateDownload"`
|
||||
// ContentIDSQ string `json:"contentIdSQ"`
|
||||
// } `json:"SQ"`
|
||||
// } `json:"codeRate"`
|
||||
// IsDownload string `json:"isDownload"`
|
||||
// CopyrightType string `json:"copyrightType"`
|
||||
// HasMv string `json:"hasMv"`
|
||||
// TopQuality string `json:"topQuality"`
|
||||
// PreSale string `json:"preSale"`
|
||||
// IsShare string `json:"isShare"`
|
||||
// IsCollection string `json:"isCollection"`
|
||||
// Length string `json:"length"`
|
||||
// SingerImg struct {
|
||||
// Num421 struct {
|
||||
// SingerName string `json:"singerName"`
|
||||
// MiguImgItems []struct {
|
||||
// ImgSizeType string `json:"imgSizeType"`
|
||||
// Img string `json:"img"`
|
||||
// FileID string `json:"fileId"`
|
||||
// WebpImg string `json:"webpImg"`
|
||||
// } `json:"miguImgItems"`
|
||||
// } `json:"421"`
|
||||
// } `json:"singerImg"`
|
||||
// SongNamePinyin string `json:"songNamePinyin"`
|
||||
// AlbumNamePinyin string `json:"albumNamePinyin"`
|
||||
// Artists []struct {
|
||||
// ID string `json:"id"`
|
||||
// Name string `json:"name"`
|
||||
// NameSpelling string `json:"nameSpelling"`
|
||||
// } `json:"artists"`
|
||||
// LandscapImg string `json:"landscapImg"`
|
||||
// VipLogo string `json:"vipLogo"`
|
||||
// VipDownload string `json:"vipDownload"`
|
||||
// FirstPublish string `json:"firstPublish"`
|
||||
// ShowTag []string `json:"showTag"`
|
||||
// MaterialValidStatus bool `json:"materialValidStatus"`
|
||||
// NeedEncrypt string `json:"needEncrypt"`
|
||||
// ForeverListen bool `json:"foreverListen"`
|
||||
// HasAssociatedRing bool `json:"hasAssociatedRing"`
|
||||
} `json:"resource"`
|
||||
}
|
||||
|
||||
type albumInfo struct {
|
||||
// Code string `json:"code"`
|
||||
// Info string `json:"info"`
|
||||
Resource []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// AlbumID string `json:"albumId"`
|
||||
// ImgItems []struct {
|
||||
// ImgSizeType string `json:"imgSizeType"`
|
||||
// Img string `json:"img"`
|
||||
// FileID string `json:"fileId"`
|
||||
// WebpImg string `json:"webpImg"`
|
||||
// } `json:"imgItems"`
|
||||
// Title string `json:"title"`
|
||||
// Singer string `json:"singer"`
|
||||
// SingerID string `json:"singerId"`
|
||||
// SingerImgs []struct {
|
||||
// ImgSizeType string `json:"imgSizeType"`
|
||||
// Img string `json:"img"`
|
||||
// FileID string `json:"fileId"`
|
||||
// WebpImg string `json:"webpImg"`
|
||||
// } `json:"singerImgs"`
|
||||
// Summary string `json:"summary"`
|
||||
// TotalCount string `json:"totalCount"`
|
||||
// PublishTime string `json:"publishTime"`
|
||||
// PublishCorp string `json:"publishCorp"`
|
||||
// OpNumItem struct {
|
||||
// PlayNum int `json:"playNum"`
|
||||
// PlayNumDesc string `json:"playNumDesc"`
|
||||
// KeepNum int `json:"keepNum"`
|
||||
// KeepNumDesc string `json:"keepNumDesc"`
|
||||
// CommentNum int `json:"commentNum"`
|
||||
// CommentNumDesc string `json:"commentNumDesc"`
|
||||
// ShareNum int `json:"shareNum"`
|
||||
// ShareNumDesc string `json:"shareNumDesc"`
|
||||
// OrderNumByWeek int `json:"orderNumByWeek"`
|
||||
// OrderNumByWeekDesc string `json:"orderNumByWeekDesc"`
|
||||
// OrderNumByTotal int `json:"orderNumByTotal"`
|
||||
// OrderNumByTotalDesc string `json:"orderNumByTotalDesc"`
|
||||
// ThumbNum int `json:"thumbNum"`
|
||||
// ThumbNumDesc string `json:"thumbNumDesc"`
|
||||
// FollowNum int `json:"followNum"`
|
||||
// FollowNumDesc string `json:"followNumDesc"`
|
||||
// SubscribeNum int `json:"subscribeNum"`
|
||||
// SubscribeNumDesc string `json:"subscribeNumDesc"`
|
||||
// LivePlayNum int `json:"livePlayNum"`
|
||||
// LivePlayNumDesc string `json:"livePlayNumDesc"`
|
||||
// PopularNum int `json:"popularNum"`
|
||||
// PopularNumDesc string `json:"popularNumDesc"`
|
||||
// BookingNum int `json:"bookingNum"`
|
||||
// BookingNumDesc string `json:"bookingNumDesc"`
|
||||
// SettingNum int `json:"settingNum"`
|
||||
// SettingNumDesc string `json:"settingNumDesc"`
|
||||
// CallNum int `json:"callNum"`
|
||||
// CallNumDesc string `json:"callNumDesc"`
|
||||
// CallingPlayNum int `json:"callingPlayNum"`
|
||||
// CallingPlayNumDesc string `json:"callingPlayNumDesc"`
|
||||
// CallingPlayDuration int `json:"callingPlayDuration"`
|
||||
// CallingPlayDurationDesc string `json:"callingPlayDurationDesc"`
|
||||
// CalledPlayDuration int `json:"calledPlayDuration"`
|
||||
// CalledPlayDurationDesc string `json:"calledPlayDurationDesc"`
|
||||
// RingtoneAppPlayNum int `json:"ringtoneAppPlayNum"`
|
||||
// RingtoneAppPlayNumDesc string `json:"ringtoneAppPlayNumDesc"`
|
||||
// RingtoneAppSettingNum int `json:"ringtoneAppSettingNum"`
|
||||
// RingtoneAppSettingNumDesc string `json:"ringtoneAppSettingNumDesc"`
|
||||
// } `json:"opNumItem"`
|
||||
// Tags []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// TagID string `json:"tagId"`
|
||||
// TagName string `json:"tagName"`
|
||||
// TagDesc string `json:"tagDesc,omitempty"`
|
||||
// } `json:"tags"`
|
||||
// AlbumAliasName string `json:"albumAliasName"`
|
||||
// AlbumClass string `json:"albumClass"`
|
||||
// Language string `json:"language"`
|
||||
// PublishCompany string `json:"publishCompany"`
|
||||
// PublishDate string `json:"publishDate"`
|
||||
// TranslateName string `json:"translateName"`
|
||||
SongItems []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// RefID string `json:"refId"`
|
||||
CopyrightID string `json:"copyrightId"`
|
||||
// ContentID string `json:"contentId"`
|
||||
// SongID string `json:"songId"`
|
||||
// SongName string `json:"songName"`
|
||||
// SingerID string `json:"singerId"`
|
||||
// Singer string `json:"singer"`
|
||||
// AlbumID string `json:"albumId"`
|
||||
// Album string `json:"album"`
|
||||
// AlbumImgs []struct {
|
||||
// ImgSizeType string `json:"imgSizeType"`
|
||||
// Img string `json:"img"`
|
||||
// FileID string `json:"fileId"`
|
||||
// WebpImg string `json:"webpImg"`
|
||||
// } `json:"albumImgs"`
|
||||
// OpNumItem struct {
|
||||
// PlayNum int `json:"playNum"`
|
||||
// PlayNumDesc string `json:"playNumDesc"`
|
||||
// KeepNum int `json:"keepNum"`
|
||||
// KeepNumDesc string `json:"keepNumDesc"`
|
||||
// CommentNum int `json:"commentNum"`
|
||||
// CommentNumDesc string `json:"commentNumDesc"`
|
||||
// ShareNum int `json:"shareNum"`
|
||||
// ShareNumDesc string `json:"shareNumDesc"`
|
||||
// OrderNumByWeek int `json:"orderNumByWeek"`
|
||||
// OrderNumByWeekDesc string `json:"orderNumByWeekDesc"`
|
||||
// OrderNumByTotal int `json:"orderNumByTotal"`
|
||||
// OrderNumByTotalDesc string `json:"orderNumByTotalDesc"`
|
||||
// ThumbNum int `json:"thumbNum"`
|
||||
// ThumbNumDesc string `json:"thumbNumDesc"`
|
||||
// FollowNum int `json:"followNum"`
|
||||
// FollowNumDesc string `json:"followNumDesc"`
|
||||
// SubscribeNum int `json:"subscribeNum"`
|
||||
// SubscribeNumDesc string `json:"subscribeNumDesc"`
|
||||
// LivePlayNum int `json:"livePlayNum"`
|
||||
// LivePlayNumDesc string `json:"livePlayNumDesc"`
|
||||
// PopularNum int `json:"popularNum"`
|
||||
// PopularNumDesc string `json:"popularNumDesc"`
|
||||
// BookingNum int `json:"bookingNum"`
|
||||
// BookingNumDesc string `json:"bookingNumDesc"`
|
||||
// SettingNum int `json:"settingNum"`
|
||||
// SettingNumDesc string `json:"settingNumDesc"`
|
||||
// CallNum int `json:"callNum"`
|
||||
// CallNumDesc string `json:"callNumDesc"`
|
||||
// CallingPlayNum int `json:"callingPlayNum"`
|
||||
// CallingPlayNumDesc string `json:"callingPlayNumDesc"`
|
||||
// CallingPlayDuration int `json:"callingPlayDuration"`
|
||||
// CallingPlayDurationDesc string `json:"callingPlayDurationDesc"`
|
||||
// CalledPlayDuration int `json:"calledPlayDuration"`
|
||||
// CalledPlayDurationDesc string `json:"calledPlayDurationDesc"`
|
||||
// RingtoneAppPlayNum int `json:"ringtoneAppPlayNum"`
|
||||
// RingtoneAppPlayNumDesc string `json:"ringtoneAppPlayNumDesc"`
|
||||
// RingtoneAppSettingNum int `json:"ringtoneAppSettingNum"`
|
||||
// RingtoneAppSettingNumDesc string `json:"ringtoneAppSettingNumDesc"`
|
||||
// } `json:"opNumItem"`
|
||||
// ToneControl string `json:"toneControl"`
|
||||
// RelatedSongs []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// ResourceTypeName string `json:"resourceTypeName"`
|
||||
// CopyrightID string `json:"copyrightId"`
|
||||
// ProductID string `json:"productId"`
|
||||
// } `json:"relatedSongs"`
|
||||
// RateFormats []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// FormatType string `json:"formatType"`
|
||||
// URL string `json:"url,omitempty"`
|
||||
// Format string `json:"format"`
|
||||
// Size string `json:"size"`
|
||||
// FileType string `json:"fileType,omitempty"`
|
||||
// Price string `json:"price"`
|
||||
// IosURL string `json:"iosUrl,omitempty"`
|
||||
// AndroidURL string `json:"androidUrl,omitempty"`
|
||||
// AndroidFileType string `json:"androidFileType,omitempty"`
|
||||
// IosFileType string `json:"iosFileType,omitempty"`
|
||||
// IosSize string `json:"iosSize,omitempty"`
|
||||
// AndroidSize string `json:"androidSize,omitempty"`
|
||||
// IosFormat string `json:"iosFormat,omitempty"`
|
||||
// AndroidFormat string `json:"androidFormat,omitempty"`
|
||||
// IosAccuracyLevel string `json:"iosAccuracyLevel,omitempty"`
|
||||
// AndroidAccuracyLevel string `json:"androidAccuracyLevel,omitempty"`
|
||||
// } `json:"rateFormats"`
|
||||
NewRateFormats []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
FormatType string `json:"formatType"`
|
||||
URL string `json:"url,omitempty"`
|
||||
// Format string `json:"format"`
|
||||
// Size string `json:"size"`
|
||||
// FileType string `json:"fileType,omitempty"`
|
||||
// Price string `json:"price"`
|
||||
// IosURL string `json:"iosUrl,omitempty"`
|
||||
AndroidURL string `json:"androidUrl,omitempty"`
|
||||
// AndroidFileType string `json:"androidFileType,omitempty"`
|
||||
// IosFileType string `json:"iosFileType,omitempty"`
|
||||
// IosSize string `json:"iosSize,omitempty"`
|
||||
// AndroidSize string `json:"androidSize,omitempty"`
|
||||
// IosFormat string `json:"iosFormat,omitempty"`
|
||||
// AndroidFormat string `json:"androidFormat,omitempty"`
|
||||
// IosAccuracyLevel string `json:"iosAccuracyLevel,omitempty"`
|
||||
// AndroidAccuracyLevel string `json:"androidAccuracyLevel,omitempty"`
|
||||
} `json:"newRateFormats"`
|
||||
// LrcURL string `json:"lrcUrl"`
|
||||
// TagList []struct {
|
||||
// ResourceType string `json:"resourceType"`
|
||||
// TagID string `json:"tagId"`
|
||||
// TagName string `json:"tagName"`
|
||||
// TagDesc string `json:"tagDesc,omitempty"`
|
||||
// } `json:"tagList"`
|
||||
// DigitalColumnID string `json:"digitalColumnId"`
|
||||
// Copyright string `json:"copyright"`
|
||||
// ValidStatus bool `json:"validStatus"`
|
||||
// SongDescs string `json:"songDescs"`
|
||||
// SongAliasName string `json:"songAliasName"`
|
||||
// IsInDAlbum string `json:"isInDAlbum"`
|
||||
// IsInSideDalbum string `json:"isInSideDalbum"`
|
||||
// IsInSalesPeriod string `json:"isInSalesPeriod"`
|
||||
// SongType string `json:"songType"`
|
||||
// MrcURL string `json:"mrcUrl"`
|
||||
// InvalidateDate string `json:"invalidateDate"`
|
||||
// DalbumID string `json:"dalbumId"`
|
||||
// TrackNumber string `json:"trackNumber"`
|
||||
// TrcURL string `json:"trcUrl"`
|
||||
// Disc string `json:"disc"`
|
||||
// VipType string `json:"vipType"`
|
||||
// ScopeOfcopyright string `json:"scopeOfcopyright"`
|
||||
// AuditionsType string `json:"auditionsType"`
|
||||
// FirstIcon string `json:"firstIcon"`
|
||||
// TranslateName string `json:"translateName,omitempty"`
|
||||
// ChargeAuditions string `json:"chargeAuditions"`
|
||||
// OldChargeAuditions string `json:"oldChargeAuditions"`
|
||||
// SongIcon string `json:"songIcon"`
|
||||
// CodeRate struct {
|
||||
// PQ struct {
|
||||
// CodeRateChargeAuditions string `json:"codeRateChargeAuditions"`
|
||||
// IsCodeRateDownload string `json:"isCodeRateDownload"`
|
||||
// CodeRateFileSize string `json:"codeRateFileSize"`
|
||||
// } `json:"PQ"`
|
||||
// HQ struct {
|
||||
// CodeRateChargeAuditions string `json:"codeRateChargeAuditions"`
|
||||
// IsCodeRateDownload string `json:"isCodeRateDownload"`
|
||||
// } `json:"HQ"`
|
||||
// SQ struct {
|
||||
// CodeRateChargeAuditions string `json:"codeRateChargeAuditions"`
|
||||
// IsCodeRateDownload string `json:"isCodeRateDownload"`
|
||||
// ContentIDSQ string `json:"contentIdSQ"`
|
||||
// } `json:"SQ"`
|
||||
// } `json:"codeRate"`
|
||||
// IsDownload string `json:"isDownload"`
|
||||
// CopyrightType string `json:"copyrightType"`
|
||||
// HasMv string `json:"hasMv"`
|
||||
// TopQuality string `json:"topQuality"`
|
||||
// PreSale string `json:"preSale"`
|
||||
// IsShare string `json:"isShare"`
|
||||
// IsCollection string `json:"isCollection"`
|
||||
// Length string `json:"length"`
|
||||
// SingerImg struct {
|
||||
// Num421 struct {
|
||||
// SingerName string `json:"singerName"`
|
||||
// MiguImgItems []struct {
|
||||
// ImgSizeType string `json:"imgSizeType"`
|
||||
// Img string `json:"img"`
|
||||
// FileID string `json:"fileId"`
|
||||
// WebpImg string `json:"webpImg"`
|
||||
// } `json:"miguImgItems"`
|
||||
// } `json:"421"`
|
||||
// } `json:"singerImg"`
|
||||
// SongNamePinyin string `json:"songNamePinyin"`
|
||||
// AlbumNamePinyin string `json:"albumNamePinyin"`
|
||||
// Artists []struct {
|
||||
// ID string `json:"id"`
|
||||
// Name string `json:"name"`
|
||||
// NameSpelling string `json:"nameSpelling"`
|
||||
// } `json:"artists"`
|
||||
// LandscapImg string `json:"landscapImg"`
|
||||
// VipLogo string `json:"vipLogo"`
|
||||
// VipDownload string `json:"vipDownload"`
|
||||
// FirstPublish string `json:"firstPublish"`
|
||||
// ShowTag []string `json:"showTag"`
|
||||
// MaterialValidStatus bool `json:"materialValidStatus"`
|
||||
// NeedEncrypt string `json:"needEncrypt"`
|
||||
// ForeverListen bool `json:"foreverListen"`
|
||||
// HasAssociatedRing bool `json:"hasAssociatedRing"`
|
||||
// LoginListenFlag string `json:"loginListenFlag,omitempty"`
|
||||
// MvCopyright string `json:"mvCopyright,omitempty"`
|
||||
// ForeverListenFlag string `json:"foreverListenFlag,omitempty"`
|
||||
} `json:"songItems"`
|
||||
} `json:"resource"`
|
||||
}
|
||||
|
@ -27,5 +27,20 @@ var (
|
||||
sources.Q_320k: `2`,
|
||||
sources.Q_flac: `3`,
|
||||
sources.Q_fl24: `4`,
|
||||
|
||||
sources.Q_master: `5`,
|
||||
}
|
||||
// qualitysReverse = map[string]string {
|
||||
// `000009`: sources.Q_128k,
|
||||
// `020010`: sources.Q_320k,
|
||||
// `011002`: sources.Q_flac,
|
||||
// `011005`: sources.Q_fl24,
|
||||
// }
|
||||
mgheader = map[string]string{
|
||||
`Origin`: `https://m.music.migu.cn`,
|
||||
`Referer`: `https://m.music.migu.cn/v4/`,
|
||||
`By`: ``,
|
||||
`channel`: ``,
|
||||
`Cookie`: ``,
|
||||
}
|
||||
)
|
||||
|
@ -1,13 +1,19 @@
|
||||
package tx
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"lx-source/src/env"
|
||||
"lx-source/src/sources"
|
||||
"strings"
|
||||
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
"github.com/ZxwyWebSite/ztool/x/bytesconv"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(musicInfo{})
|
||||
}
|
||||
|
||||
func getMusicInfo(songMid string) (infoBody musicInfo, emsg string) {
|
||||
cquery := strings.Join([]string{`tx`, songMid, `info`}, `/`)
|
||||
if cdata, ok := env.Cache.Get(cquery); ok {
|
||||
@ -37,6 +43,6 @@ func getMusicInfo(songMid string) (infoBody musicInfo, emsg string) {
|
||||
return //nil, `获取音乐信息失败`
|
||||
}
|
||||
infoBody = infoResp.Req.Data
|
||||
env.Cache.Set(cquery, infoBody, 7200)
|
||||
env.Cache.Set(cquery, infoBody, sources.C_lx)
|
||||
return //infoBody.Req.Data, ``
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ import (
|
||||
返回结果
|
||||
更新:
|
||||
可通过 goto loop 实现,但可能会导致逻辑混乱 (想使用账号获取正常链接却返回试听链接)
|
||||
2024-03-16:
|
||||
正常获取->128k获取->试听获取
|
||||
*/
|
||||
|
||||
func Url(songMid, quality string) (ourl, msg string) {
|
||||
@ -54,7 +56,12 @@ func Url(songMid, quality string) (ourl, msg string) {
|
||||
}
|
||||
var strFileName string
|
||||
tryLink := infoBody.TrackInfo.Pay.PayPlay == 1 && /*uauthst == ``&&*/ !env.Config.Custom.Tx_Enable
|
||||
Loop:
|
||||
if tryLink {
|
||||
if infoBody.TrackInfo.Vs[0] == `` {
|
||||
msg = sources.ErrNoLink
|
||||
return
|
||||
}
|
||||
strFileName = ztool.Str_FastConcat(`RS02`, infoBody.TrackInfo.Vs[0], `.`, sources.X_mp3)
|
||||
} else {
|
||||
strFileName = ztool.Str_FastConcat(infoFile.H, infoBody.TrackInfo.File.MediaMid, `.`, infoFile.E)
|
||||
@ -92,6 +99,16 @@ func Url(songMid, quality string) (ourl, msg string) {
|
||||
}
|
||||
infoData := infoResp.Req0.Data.Midurlinfo[0]
|
||||
if infoData.Purl == `` {
|
||||
if env.Config.Source.ForceFallback && !tryLink {
|
||||
if quality != sources.Q_128k && infoBody.TrackInfo.Pay.PayPlay == 0 {
|
||||
msg = `Fallback to 128k`
|
||||
infoFile = fileInfo[sources.Q_128k]
|
||||
} else {
|
||||
msg = `Fallbacked`
|
||||
tryLink = true
|
||||
}
|
||||
goto Loop
|
||||
}
|
||||
msg = sources.E_NoLink //`无法获取音乐链接`
|
||||
return
|
||||
}
|
||||
@ -102,8 +119,10 @@ func Url(songMid, quality string) (ourl, msg string) {
|
||||
// }
|
||||
if realQuality != infoFile.H && !tryLink {
|
||||
msg = sources.E_QNotMatch
|
||||
return
|
||||
if !env.Config.Source.ForceFallback {
|
||||
return
|
||||
}
|
||||
}
|
||||
ourl = ztool.Str_FastConcat(`https://ws.stream.qqmusic.qq.com/`, infoData.Purl)
|
||||
ourl = `https://ws.stream.qqmusic.qq.com/` + infoData.Purl
|
||||
return
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"lx-source/src/env"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ZxwyWebSite/ztool"
|
||||
"github.com/ZxwyWebSite/ztool/logs"
|
||||
@ -129,7 +130,9 @@ func refresh(loger *logs.Logger, now int64) error {
|
||||
loger.Info(`刷新登录成功`)
|
||||
env.Config.Custom.Tx_Uuin = resp.Req1.Data.StrMusicId
|
||||
env.Config.Custom.Tx_Ukey = resp.Req1.Data.MusicKey
|
||||
env.Config.Custom.Tx_Refresh_Interval = now + 432000 //(每5天刷新一次) //1209600 - 86000 // 14天提前一天
|
||||
tnow := time.Now()
|
||||
env.Config.Custom.Tx_Refresh_Interval = time.Date(tnow.Year(), tnow.Month(), tnow.Day()+5, 0, 0, 0, 0, tnow.Location()).Unix()
|
||||
// env.Config.Custom.Tx_Refresh_Interval = now + 432000 //(每5天刷新一次) //1209600 - 86000 // 14天提前一天
|
||||
loger.Debug(`Resp: %+v`, resp)
|
||||
loger.Debug(`Uuin: %v, Ukey: %v`, resp.Req1.Data.StrMusicId, resp.Req1.Data.MusicKey)
|
||||
loger.Debug(`ExpiresAt: %v, Real: %v`, resp.Req1.Data.ExpiredAt, env.Config.Custom.Tx_Refresh_Interval)
|
||||
|
@ -74,173 +74,173 @@ type musicInfo struct {
|
||||
// Wikiurl string `json:"wikiurl"`
|
||||
// } `json:"extras"`
|
||||
TrackInfo struct {
|
||||
ID int `json:"id"`
|
||||
Type int `json:"type"`
|
||||
Mid string `json:"mid"`
|
||||
Name string `json:"name"`
|
||||
Title string `json:"title"`
|
||||
Subtitle string `json:"subtitle"`
|
||||
Singer []struct {
|
||||
ID int `json:"id"`
|
||||
Mid string `json:"mid"`
|
||||
Name string `json:"name"`
|
||||
Title string `json:"title"`
|
||||
Type int `json:"type"`
|
||||
Uin int `json:"uin"`
|
||||
} `json:"singer"`
|
||||
Album struct {
|
||||
ID int `json:"id"`
|
||||
Mid string `json:"mid"`
|
||||
Name string `json:"name"`
|
||||
Title string `json:"title"`
|
||||
Subtitle string `json:"subtitle"`
|
||||
TimePublic string `json:"time_public"`
|
||||
Pmid string `json:"pmid"`
|
||||
} `json:"album"`
|
||||
Mv struct {
|
||||
ID int `json:"id"`
|
||||
Vid string `json:"vid"`
|
||||
Name string `json:"name"`
|
||||
Title string `json:"title"`
|
||||
Vt int `json:"vt"`
|
||||
} `json:"mv"`
|
||||
Interval int `json:"interval"`
|
||||
Isonly int `json:"isonly"`
|
||||
Language int `json:"language"`
|
||||
Genre int `json:"genre"`
|
||||
IndexCd int `json:"index_cd"`
|
||||
IndexAlbum int `json:"index_album"`
|
||||
TimePublic string `json:"time_public"`
|
||||
Status int `json:"status"`
|
||||
Fnote int `json:"fnote"`
|
||||
File struct {
|
||||
MediaMid string `json:"media_mid"`
|
||||
Size24Aac int `json:"size_24aac"`
|
||||
Size48Aac int `json:"size_48aac"`
|
||||
Size96Aac int `json:"size_96aac"`
|
||||
Size192Ogg int `json:"size_192ogg"`
|
||||
Size192Aac int `json:"size_192aac"`
|
||||
Size128Mp3 int `json:"size_128mp3"`
|
||||
Size320Mp3 int `json:"size_320mp3"`
|
||||
SizeApe int `json:"size_ape"`
|
||||
SizeFlac int `json:"size_flac"`
|
||||
SizeDts int `json:"size_dts"`
|
||||
SizeTry int `json:"size_try"`
|
||||
TryBegin int `json:"try_begin"`
|
||||
TryEnd int `json:"try_end"`
|
||||
URL string `json:"url"`
|
||||
SizeHires int `json:"size_hires"`
|
||||
HiresSample int `json:"hires_sample"`
|
||||
HiresBitdepth int `json:"hires_bitdepth"`
|
||||
B30S int `json:"b_30s"`
|
||||
E30S int `json:"e_30s"`
|
||||
Size96Ogg int `json:"size_96ogg"`
|
||||
Size360Ra []interface{} `json:"size_360ra"`
|
||||
SizeDolby int `json:"size_dolby"`
|
||||
SizeNew []int `json:"size_new"`
|
||||
// ID int `json:"id"`
|
||||
// Type int `json:"type"`
|
||||
// Mid string `json:"mid"`
|
||||
// Name string `json:"name"`
|
||||
// Title string `json:"title"`
|
||||
// Subtitle string `json:"subtitle"`
|
||||
// Singer []struct {
|
||||
// ID int `json:"id"`
|
||||
// Mid string `json:"mid"`
|
||||
// Name string `json:"name"`
|
||||
// Title string `json:"title"`
|
||||
// Type int `json:"type"`
|
||||
// Uin int `json:"uin"`
|
||||
// } `json:"singer"`
|
||||
// Album struct {
|
||||
// ID int `json:"id"`
|
||||
// Mid string `json:"mid"`
|
||||
// Name string `json:"name"`
|
||||
// Title string `json:"title"`
|
||||
// Subtitle string `json:"subtitle"`
|
||||
// TimePublic string `json:"time_public"`
|
||||
// Pmid string `json:"pmid"`
|
||||
// } `json:"album"`
|
||||
// Mv struct {
|
||||
// ID int `json:"id"`
|
||||
// Vid string `json:"vid"`
|
||||
// Name string `json:"name"`
|
||||
// Title string `json:"title"`
|
||||
// Vt int `json:"vt"`
|
||||
// } `json:"mv"`
|
||||
// Interval int `json:"interval"`
|
||||
// Isonly int `json:"isonly"`
|
||||
// Language int `json:"language"`
|
||||
// Genre int `json:"genre"`
|
||||
// IndexCd int `json:"index_cd"`
|
||||
// IndexAlbum int `json:"index_album"`
|
||||
// TimePublic string `json:"time_public"`
|
||||
// Status int `json:"status"`
|
||||
// Fnote int `json:"fnote"`
|
||||
File struct {
|
||||
MediaMid string `json:"media_mid"`
|
||||
// Size24Aac int `json:"size_24aac"`
|
||||
// Size48Aac int `json:"size_48aac"`
|
||||
// Size96Aac int `json:"size_96aac"`
|
||||
// Size192Ogg int `json:"size_192ogg"`
|
||||
// Size192Aac int `json:"size_192aac"`
|
||||
// Size128Mp3 int `json:"size_128mp3"`
|
||||
// Size320Mp3 int `json:"size_320mp3"`
|
||||
// SizeApe int `json:"size_ape"`
|
||||
// SizeFlac int `json:"size_flac"`
|
||||
// SizeDts int `json:"size_dts"`
|
||||
// SizeTry int `json:"size_try"`
|
||||
// TryBegin int `json:"try_begin"`
|
||||
// TryEnd int `json:"try_end"`
|
||||
// URL string `json:"url"`
|
||||
// SizeHires int `json:"size_hires"`
|
||||
// HiresSample int `json:"hires_sample"`
|
||||
// HiresBitdepth int `json:"hires_bitdepth"`
|
||||
// B30S int `json:"b_30s"`
|
||||
// E30S int `json:"e_30s"`
|
||||
// Size96Ogg int `json:"size_96ogg"`
|
||||
// Size360Ra []interface{} `json:"size_360ra"`
|
||||
// SizeDolby int `json:"size_dolby"`
|
||||
// SizeNew []int `json:"size_new"`
|
||||
} `json:"file"`
|
||||
Pay struct {
|
||||
PayMonth int `json:"pay_month"`
|
||||
PriceTrack int `json:"price_track"`
|
||||
PriceAlbum int `json:"price_album"`
|
||||
PayPlay int `json:"pay_play"`
|
||||
PayDown int `json:"pay_down"`
|
||||
PayStatus int `json:"pay_status"`
|
||||
TimeFree int `json:"time_free"`
|
||||
// PayMonth int `json:"pay_month"`
|
||||
// PriceTrack int `json:"price_track"`
|
||||
// PriceAlbum int `json:"price_album"`
|
||||
PayPlay int `json:"pay_play"`
|
||||
// PayDown int `json:"pay_down"`
|
||||
// PayStatus int `json:"pay_status"`
|
||||
// TimeFree int `json:"time_free"`
|
||||
} `json:"pay"`
|
||||
Action struct {
|
||||
Switch int `json:"switch"`
|
||||
Msgid int `json:"msgid"`
|
||||
Alert int `json:"alert"`
|
||||
Icons int `json:"icons"`
|
||||
Msgshare int `json:"msgshare"`
|
||||
Msgfav int `json:"msgfav"`
|
||||
Msgdown int `json:"msgdown"`
|
||||
Msgpay int `json:"msgpay"`
|
||||
Switch2 int `json:"switch2"`
|
||||
Icon2 int `json:"icon2"`
|
||||
} `json:"action"`
|
||||
Ksong struct {
|
||||
ID int `json:"id"`
|
||||
Mid string `json:"mid"`
|
||||
} `json:"ksong"`
|
||||
Volume struct {
|
||||
Gain float64 `json:"gain"`
|
||||
Peak float64 `json:"peak"`
|
||||
Lra float64 `json:"lra"`
|
||||
} `json:"volume"`
|
||||
Label string `json:"label"`
|
||||
URL string `json:"url"`
|
||||
Bpm int `json:"bpm"`
|
||||
Version int `json:"version"`
|
||||
Trace string `json:"trace"`
|
||||
DataType int `json:"data_type"`
|
||||
ModifyStamp int `json:"modify_stamp"`
|
||||
Pingpong string `json:"pingpong"`
|
||||
Ppurl string `json:"ppurl"`
|
||||
Tid int `json:"tid"`
|
||||
Ov int `json:"ov"`
|
||||
Sa int `json:"sa"`
|
||||
Es string `json:"es"`
|
||||
Vs []string `json:"vs"`
|
||||
Vi []int `json:"vi"`
|
||||
Ktag string `json:"ktag"`
|
||||
Vf []float64 `json:"vf"`
|
||||
// Action struct {
|
||||
// Switch int `json:"switch"`
|
||||
// Msgid int `json:"msgid"`
|
||||
// Alert int `json:"alert"`
|
||||
// Icons int `json:"icons"`
|
||||
// Msgshare int `json:"msgshare"`
|
||||
// Msgfav int `json:"msgfav"`
|
||||
// Msgdown int `json:"msgdown"`
|
||||
// Msgpay int `json:"msgpay"`
|
||||
// Switch2 int `json:"switch2"`
|
||||
// Icon2 int `json:"icon2"`
|
||||
// } `json:"action"`
|
||||
// Ksong struct {
|
||||
// ID int `json:"id"`
|
||||
// Mid string `json:"mid"`
|
||||
// } `json:"ksong"`
|
||||
// Volume struct {
|
||||
// Gain float64 `json:"gain"`
|
||||
// Peak float64 `json:"peak"`
|
||||
// Lra float64 `json:"lra"`
|
||||
// } `json:"volume"`
|
||||
// Label string `json:"label"`
|
||||
// URL string `json:"url"`
|
||||
// Bpm int `json:"bpm"`
|
||||
// Version int `json:"version"`
|
||||
// Trace string `json:"trace"`
|
||||
// DataType int `json:"data_type"`
|
||||
// ModifyStamp int `json:"modify_stamp"`
|
||||
// Pingpong string `json:"pingpong"`
|
||||
// Ppurl string `json:"ppurl"`
|
||||
// Tid int `json:"tid"`
|
||||
// Ov int `json:"ov"`
|
||||
// Sa int `json:"sa"`
|
||||
// Es string `json:"es"`
|
||||
Vs []string `json:"vs"`
|
||||
// Vi []int `json:"vi"`
|
||||
// Ktag string `json:"ktag"`
|
||||
// Vf []float64 `json:"vf"`
|
||||
} `json:"track_info"`
|
||||
}
|
||||
|
||||
type playInfo struct {
|
||||
Code int `json:"code"`
|
||||
// Code int `json:"code"`
|
||||
Data struct {
|
||||
Uin string `json:"uin"`
|
||||
Retcode int `json:"retcode"`
|
||||
VerifyType int `json:"verify_type"`
|
||||
LoginKey string `json:"login_key"`
|
||||
Msg string `json:"msg"`
|
||||
Sip []string `json:"sip"`
|
||||
Thirdip []string `json:"thirdip"`
|
||||
Testfile2G string `json:"testfile2g"`
|
||||
Testfilewifi string `json:"testfilewifi"`
|
||||
Midurlinfo []struct {
|
||||
Songmid string `json:"songmid"`
|
||||
Filename string `json:"filename"`
|
||||
Purl string `json:"purl"`
|
||||
Errtype string `json:"errtype"`
|
||||
P2Pfromtag int `json:"p2pfromtag"`
|
||||
Qmdlfromtag int `json:"qmdlfromtag"`
|
||||
CommonDownfromtag int `json:"common_downfromtag"`
|
||||
VipDownfromtag int `json:"vip_downfromtag"`
|
||||
Pdl int `json:"pdl"`
|
||||
Premain int `json:"premain"`
|
||||
Hisdown int `json:"hisdown"`
|
||||
Hisbuy int `json:"hisbuy"`
|
||||
UIAlert int `json:"uiAlert"`
|
||||
Isbuy int `json:"isbuy"`
|
||||
Pneedbuy int `json:"pneedbuy"`
|
||||
Pneed int `json:"pneed"`
|
||||
Isonly int `json:"isonly"`
|
||||
Onecan int `json:"onecan"`
|
||||
Result int `json:"result"`
|
||||
Tips string `json:"tips"`
|
||||
Opi48Kurl string `json:"opi48kurl"`
|
||||
Opi96Kurl string `json:"opi96kurl"`
|
||||
Opi192Kurl string `json:"opi192kurl"`
|
||||
Opiflackurl string `json:"opiflackurl"`
|
||||
Opi128Kurl string `json:"opi128kurl"`
|
||||
Opi192Koggurl string `json:"opi192koggurl"`
|
||||
Wififromtag string `json:"wififromtag"`
|
||||
Flowfromtag string `json:"flowfromtag"`
|
||||
Wifiurl string `json:"wifiurl"`
|
||||
Flowurl string `json:"flowurl"`
|
||||
Vkey string `json:"vkey"`
|
||||
Opi30Surl string `json:"opi30surl"`
|
||||
Ekey string `json:"ekey"`
|
||||
AuthSwitch int `json:"auth_switch"`
|
||||
Subcode int `json:"subcode"`
|
||||
Opi96Koggurl string `json:"opi96koggurl"`
|
||||
AuthSwitch2 int `json:"auth_switch2"`
|
||||
// Uin string `json:"uin"`
|
||||
// Retcode int `json:"retcode"`
|
||||
// VerifyType int `json:"verify_type"`
|
||||
// LoginKey string `json:"login_key"`
|
||||
// Msg string `json:"msg"`
|
||||
// Sip []string `json:"sip"`
|
||||
// Thirdip []string `json:"thirdip"`
|
||||
// Testfile2G string `json:"testfile2g"`
|
||||
// Testfilewifi string `json:"testfilewifi"`
|
||||
Midurlinfo []struct {
|
||||
// Songmid string `json:"songmid"`
|
||||
Filename string `json:"filename"`
|
||||
Purl string `json:"purl"`
|
||||
// Errtype string `json:"errtype"`
|
||||
// P2Pfromtag int `json:"p2pfromtag"`
|
||||
// Qmdlfromtag int `json:"qmdlfromtag"`
|
||||
// CommonDownfromtag int `json:"common_downfromtag"`
|
||||
// VipDownfromtag int `json:"vip_downfromtag"`
|
||||
// Pdl int `json:"pdl"`
|
||||
// Premain int `json:"premain"`
|
||||
// Hisdown int `json:"hisdown"`
|
||||
// Hisbuy int `json:"hisbuy"`
|
||||
// UIAlert int `json:"uiAlert"`
|
||||
// Isbuy int `json:"isbuy"`
|
||||
// Pneedbuy int `json:"pneedbuy"`
|
||||
// Pneed int `json:"pneed"`
|
||||
// Isonly int `json:"isonly"`
|
||||
// Onecan int `json:"onecan"`
|
||||
// Result int `json:"result"`
|
||||
// Tips string `json:"tips"`
|
||||
// Opi48Kurl string `json:"opi48kurl"`
|
||||
// Opi96Kurl string `json:"opi96kurl"`
|
||||
// Opi192Kurl string `json:"opi192kurl"`
|
||||
// Opiflackurl string `json:"opiflackurl"`
|
||||
// Opi128Kurl string `json:"opi128kurl"`
|
||||
// Opi192Koggurl string `json:"opi192koggurl"`
|
||||
// Wififromtag string `json:"wififromtag"`
|
||||
// Flowfromtag string `json:"flowfromtag"`
|
||||
// Wifiurl string `json:"wifiurl"`
|
||||
// Flowurl string `json:"flowurl"`
|
||||
// Vkey string `json:"vkey"`
|
||||
// Opi30Surl string `json:"opi30surl"`
|
||||
// Ekey string `json:"ekey"`
|
||||
// AuthSwitch int `json:"auth_switch"`
|
||||
// Subcode int `json:"subcode"`
|
||||
// Opi96Koggurl string `json:"opi96koggurl"`
|
||||
// AuthSwitch2 int `json:"auth_switch2"`
|
||||
} `json:"midurlinfo"`
|
||||
Servercheck string `json:"servercheck"`
|
||||
Expiration int `json:"expiration"`
|
||||
// Servercheck string `json:"servercheck"`
|
||||
// Expiration int `json:"expiration"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"lx-source/src/env"
|
||||
wy "lx-source/src/sources/custom/wy/modules"
|
||||
"maps"
|
||||
"time"
|
||||
|
||||
// "time"
|
||||
|
||||
@ -59,7 +60,9 @@ func refresh(loger *logs.Logger, now int64) error {
|
||||
// env.Config.Custom.Wy_Refresh_Interval = now + 86000
|
||||
// loger.Debug(`MUSIC_U 不变, 1天 后 继续执行`) //`未发现有效结果,将在下次检测时再次尝试`
|
||||
// }
|
||||
env.Config.Custom.Wy_Refresh_Interval = now + 86000
|
||||
tnow := time.Now()
|
||||
env.Config.Custom.Wy_Refresh_Interval = time.Date(tnow.Year(), tnow.Month(), tnow.Day()+1, 0, 0, 0, 0, tnow.Location()).Unix()
|
||||
// env.Config.Custom.Wy_Refresh_Interval = now + 86000
|
||||
err = env.Cfg.Save(``)
|
||||
if err == nil {
|
||||
loger.Info(`配置更新成功`)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package sources
|
||||
|
||||
import (
|
||||
"lx-source/src/caches"
|
||||
)
|
||||
// import (
|
||||
// "lx-source/src/caches"
|
||||
// )
|
||||
|
||||
// var Loger = env.Loger.NewGroup(`Sources`) // JieXiApis
|
||||
|
||||
@ -71,18 +71,18 @@ var (
|
||||
验证部分放到GetLink里
|
||||
|
||||
*/
|
||||
type Source interface {
|
||||
Verify(*caches.Query) (string, bool) // 验证是否可用 <查询参数> <rquery,ok>
|
||||
GetLink(*caches.Query) (string, string) // 查询获取链接 <查询参数> <链接,信息>
|
||||
}
|
||||
// type Source interface {
|
||||
// Verify(*caches.Query) (string, bool) // 验证是否可用 <查询参数> <rquery,ok>
|
||||
// GetLink(*caches.Query) (string, string) // 查询获取链接 <查询参数> <链接,信息>
|
||||
// }
|
||||
|
||||
// 默认空接口
|
||||
type NullSource struct{}
|
||||
// type NullSource struct{}
|
||||
|
||||
func (*NullSource) Verify(*caches.Query) (string, bool) { return ``, false }
|
||||
func (*NullSource) GetLink(*caches.Query) (string, string) { return ``, `NullSource` }
|
||||
// func (*NullSource) Verify(*caches.Query) (string, bool) { return ``, false }
|
||||
// func (*NullSource) GetLink(*caches.Query) (string, string) { return ``, `NullSource` }
|
||||
|
||||
var UseSource Source = &NullSource{} // = &builtin.Source{}
|
||||
// var UseSource Source = &NullSource{} // = &builtin.Source{}
|
||||
|
||||
// 统一错误
|
||||
// type (
|
||||
|
@ -1,3 +1,5 @@
|
||||
//go:build extapp
|
||||
|
||||
package sources
|
||||
|
||||
// MusicFree 数据结构
|
||||
|
19
update.md
19
update.md
@ -3,6 +3,25 @@
|
||||
<!-- #### \# 2024-02-14 v1.0.3-rel (release)
|
||||
+ **停止更新:感谢这三个月的陪伴,现因无力维护,停止后续更新,发布最后版本,大家有缘再见** -->
|
||||
|
||||
#### \# 2024-03-16 v1.0.3-rc2 (dev)
|
||||
+ Mg源新增接口,无需登录账号(二次查询,速度较慢)
|
||||
+ 清理部分结构体未使用字段
|
||||
+ Tx源支持音质Fallback
|
||||
+ Kg源Lite签到重试
|
||||
<!-- + 移除Wy源内置接口(上游停止服务) -->
|
||||
|
||||
#### \# 2024-03-08 v1.0.3-rc2 (dev)
|
||||
+ 完善音质验证部分
|
||||
+ 刷新登录更新时间统一为指定日期0时0秒
|
||||
<!-- + Mg源支持网页版接口 -->
|
||||
|
||||
#### \# 2024-02-22 v1.0.3-rc2 (dev)
|
||||
+ 清理无用代码,删除旧版Router
|
||||
+ 支持将内存缓存写入文件,重启程序不丢数据
|
||||
+ 优化计划任务逻辑: 发生错误不更新下次执行时间,以便在下次检测时重试
|
||||
+ **注:开学在即,项目暂缓更新**
|
||||
<!-- + 引入GORM和SQLite驱动 (支持不开cgo编译,但可能会导致数据库性能下降) -->
|
||||
|
||||
#### \# 2024-02-22 v1.0.3-rc1 (dev)
|
||||
+ 修复wy源sky音质获取,增加更高音质常量
|
||||
+ (dolby->高清环绕, sky->沉浸环绕, master->超清母带)
|
||||
|
Loading…
x
Reference in New Issue
Block a user