From e9fd6578528f3b04ac7df6759bb2b5357cc8bd4d Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sun, 5 Mar 2023 18:29:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96tx=E6=AD=8C=E5=8D=95=E6=89=93?= =?UTF-8?q?=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/utils/musicSdk/tx/songList.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/renderer/utils/musicSdk/tx/songList.js b/src/renderer/utils/musicSdk/tx/songList.js index caaa4508..77371cbe 100644 --- a/src/renderer/utils/musicSdk/tx/songList.js +++ b/src/renderer/utils/musicSdk/tx/songList.js @@ -24,8 +24,8 @@ export default { // https://y.qq.com/n/yqq/playlist/7217720898.html // https://i.y.qq.com/n2/m/share/details/taoge.html?platform=11&appshare=android_qq&appversion=9050006&id=7217720898&ADTAG=qfshare - listDetailLink1: /^.+(?:(?:\?|&)id=|ryqq\/playlist\/)(\d+)(?:&.*$|#.*$|$)/, - listDetailLink2: /^.+\/(\d+)\.html(?:\?.*|&.*$|#.*$|$)/, + listDetailLink: /\/playlist\/(\d+)/, + listDetailLink2: /id=(\d+)/, }, tagsUrl: 'https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=wk_v15.json&needNewCode=0&data=%7B%22tags%22%3A%7B%22method%22%3A%22get_all_categories%22%2C%22param%22%3A%7B%22qq%22%3A%22%22%7D%2C%22module%22%3A%22playlist.PlaylistAllCategoriesServer%22%7D%7D', hotTagUrl: 'https://c.y.qq.com/node/pc/wk_v15/category_playlist.html', @@ -188,13 +188,15 @@ export default { async getListId(id) { if ((/[?&:/]/.test(id))) { - let regx = /\/\/i\.y\.qq\.com/.test(id) ? this.regExps.listDetailLink1 : this.regExps.listDetailLink2 - if (!regx.test(id)) { + if (!this.regExps.listDetailLink.test(id)) { id = await this.handleParseId(id) - regx = this.regExps.listDetailLink1 - console.log(id) } - id = id.replace(regx, '$1') + let result = this.regExps.listDetailLink.exec(id) + if (!result) { + result = this.regExps.listDetailLink2.exec(id) + if (!result) throw new Error('failed') + } + id = result[1] // console.log(id) } return id