增加kg排行榜flac24bit显示

This commit is contained in:
Folltoshe 2023-03-12 22:45:17 +08:00
parent c11c202248
commit f30770fdbb

View File

@ -61,8 +61,8 @@ export default {
bangid: '31308', bangid: '31308',
}, },
], ],
getUrl(p, id) { getUrl(p, id, limit = 100) {
return `http://www2.kugou.kugou.com/yueku/v9/rank/home/${p}-${id}.html` return `http://mobilecdnbj.kugou.com/api/v3/rank/song?version=9108&ranktype=1&plat=0&pagesize=${limit}&area_code=1&page=${p}&rankid=${id}&with_res_tag=1&show_portrait_mv=1`
}, },
regExps: { regExps: {
total: /total: '(\d+)',/, total: /total: '(\d+)',/,
@ -93,41 +93,41 @@ export default {
hash: item.hash, hash: item.hash,
} }
} }
if (item.filesize_320 !== 0) { if (item['320filesize'] !== 0) {
let size = sizeFormate(item.filesize_320) let size = sizeFormate(item['320filesize'])
types.push({ type: '320k', size, hash: item.hash_320 }) types.push({ type: '320k', size, hash: item['320hash'] })
_types['320k'] = { _types['320k'] = {
size, size,
hash: item.hash_320, hash: item['320hash'],
} }
} }
if (item.filesize_ape !== 0) { if (item.sqfilesize !== 0) {
let size = sizeFormate(item.filesize_ape) let size = sizeFormate(item.sqfilesize)
types.push({ type: 'ape', size, hash: item.hash_ape }) types.push({ type: 'flac', size, hash: item.sqhash })
_types.ape = {
size,
hash: item.hash_ape,
}
}
if (item.filesize_flac !== 0) {
let size = sizeFormate(item.filesize_flac)
types.push({ type: 'flac', size, hash: item.hash_flac })
_types.flac = { _types.flac = {
size, size,
hash: item.hash_flac, hash: item.sqhash,
}
}
if (item.filesize_high !== 0) {
let size = sizeFormate(item.filesize_high)
types.push({ type: 'flac24bit', size, hash: item.hash_high })
_types.flac = {
size,
hash: item.hash_high,
} }
} }
return { return {
singer: decodeName(item.singername), singer: decodeName(item.authors.map(e => e.author_name).toString()),
name: decodeName(item.songname), name: decodeName(item.songname),
albumName: decodeName(item.album_name), albumName: decodeName(item.remark),
albumId: item.album_id, albumId: item.album_id,
songmid: item.audio_id, songmid: item.audio_id,
source: 'kg', source: 'kg',
interval: formatPlayTime(item.duration / 1000), interval: formatPlayTime(item.duration),
img: null, img: null,
lrc: null, lrc: null,
hash: item.HASH, hash: item.hash,
otherSource: null, otherSource: null,
types, types,
_types, _types,
@ -173,15 +173,14 @@ export default {
} }
}, },
getList(bangid, page) { getList(bangid, page) {
return this.getData(this.getUrl(page, bangid)).then(({ body: html }) => { return this.getData(this.getUrl(page, bangid)).then(({ body }) => {
let total = html.match(this.regExps.total) // console.log(body)
if (total) total = parseInt(RegExp.$1) let jsondata = JSON.parse(body.substring(23, body.length - 21))
page = html.match(this.regExps.page) let total = jsondata.data.total
if (page) page = parseInt(RegExp.$1) let limit = 100
let limit = html.match(this.regExps.limit) let page = Math.ceil(jsondata.data.total / limit) || 1
if (limit) limit = parseInt(RegExp.$1) let listData = this.filterData(jsondata.data.info)
let listData = html.match(this.regExps.listData) console.log(listData, 1)
if (listData) listData = this.filterData(JSON.parse(RegExp.$1))
return { return {
total, total,
list: listData, list: listData,