From c99e7301f37a0ef2e5eefc176f6a84c5a7179530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=84=86=E8=96=AF=E9=A5=BC?= Date: Thu, 21 Nov 2024 23:45:21 +0800 Subject: [PATCH] fix(External.Lyrics.response) Update External.Lyrics.response.dev.js Update External.Lyrics.response.js Update CHANGELOG.md Update package.json --- CHANGELOG.md | 12 +++--------- package.json | 2 +- src/External.Lyrics.response.dev.js | 29 ++++++++++++++--------------- src/External.Lyrics.response.js | 23 +++++++++++------------ 4 files changed, 29 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8689e6ad..61c1a8bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,5 @@ -### 🆕 New Features - * 新增支持 `Max` 平台国际服 - * `Surge` 模块内置`参数面板`新增`字幕位置设置`功能 - * `Loon` 插件内置`设置面板`新增`字幕位置选择`功能 +### 🛠️ Bug Fixes + * 修复 `External.Lyrics.response` 的`网易云音乐`歌词源`逐字歌词`丢失的问题 ### 🔣 Dependencies - * 升级了 `@nsnanocat/url` - * 使用了全新的 `URL` 和 `URLSearchParams` polyfill - * 升级了 `@nsnanocat/util` - * `util` 由 `submodule` 更改为 `package` - * `$platform` 改为 `$app` + * 移除了 `External.Lyrics.response` 中的 `@nsnanocat/url` polyfill diff --git a/package.json b/package.json index b4804383..144911d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dualsubs/universal", - "version": "1.6.6", + "version": "1.6.7", "organizationName": "🍿️ DualSubs", "displayName": "🍿️ DualSubs: 🔣 Universal", "description": "流媒体平台字幕增强及双语模块\n如需恢复TV完整支持\n请配合“ iRingo: 📺 TV”使用", diff --git a/src/External.Lyrics.response.dev.js b/src/External.Lyrics.response.dev.js index 20be4bbb..845dd505 100644 --- a/src/External.Lyrics.response.dev.js +++ b/src/External.Lyrics.response.dev.js @@ -1,5 +1,4 @@ import { $app, Lodash as _, Storage, fetch, notification, log, logError, wait, done } from "@nsnanocat/util"; -import { URL } from "@nsnanocat/url"; import LRC from "./LRC/LRC.mjs"; import database from "./database/index.mjs"; import setENV from "./function/setENV.mjs"; @@ -316,9 +315,9 @@ async function searchTrack(vendor = "NeteaseMusic", keyword = "", UAPool = []) { switch (vendor) { case "NeteaseMusic": { const searchUrl = new URL("https://music.163.com/api/cloudsearch/pc"); - searchUrl.searchParams.set("type", "1"); - searchUrl.searchParams.set("limit", "1"); - searchUrl.searchParams.set("offset", "0"); + searchUrl.searchParams.set("type", 1); + searchUrl.searchParams.set("limit", 1); + searchUrl.searchParams.set("offset", 0); searchUrl.searchParams.set("s", keyword); log(`🚧 searchUrl: ${searchUrl.toJSON()}`, ""); Request.url = searchUrl.toString(); @@ -341,9 +340,9 @@ async function searchTrack(vendor = "NeteaseMusic", keyword = "", UAPool = []) { ]; // 搜索歌曲 const searchUrl = new URL(`https://${HostPool[Math.floor(Math.random() * HostPool.length)]}/cloudsearch`); - searchUrl.searchParams.set("type", "1"); - searchUrl.searchParams.set("limit", "1"); - searchUrl.searchParams.set("offset", "0"); + searchUrl.searchParams.set("type", 1); + searchUrl.searchParams.set("limit", 1); + searchUrl.searchParams.set("offset", 0); searchUrl.searchParams.set("keywords", keyword); log(`🚧 searchUrl: ${searchUrl.toJSON()}`, ""); Request.url = searchUrl.toString(); @@ -383,8 +382,8 @@ async function searchTrack(vendor = "NeteaseMusic", keyword = "", UAPool = []) { case "QQMusicOld": { const searchUrl = new URL("https://c.y.qq.com/soso/fcgi-bin/search_for_qq_cp"); searchUrl.searchParams.set("format", "json"); - searchUrl.searchParams.set("p", "1"); - searchUrl.searchParams.set("n", "1"); + searchUrl.searchParams.set("p", 1); + searchUrl.searchParams.set("n", 1); searchUrl.searchParams.set("w", keyword); searchUrl.searchParams.set("remoteplace", "txt.yqq.song"); log(`🚧 searchUrl: ${searchUrl.toJSON()}`, ""); @@ -442,9 +441,9 @@ async function searchLyric(vendor = "NeteaseMusic", trackId = undefined, UAPool case "NeteaseMusic": { const lyricUrl = new URL("https://music.163.com/api/song/lyric"); lyricUrl.searchParams.set("id", trackId); // trackInfo.NeteaseMusic.id - lyricUrl.searchParams.set("lv", "0"); - lyricUrl.searchParams.set("tv", "0"); - lyricUrl.searchParams.set("tv", "0"); + lyricUrl.searchParams.set("lv", -1); + lyricUrl.searchParams.set("yv", -1); + lyricUrl.searchParams.set("tv", -1); log(`🚧 lyricUrl: ${lyricUrl.toJSON()}`, ""); Request.url = lyricUrl.toString(); Request.headers.Referer = "https://music.163.com"; @@ -483,9 +482,9 @@ async function searchLyric(vendor = "NeteaseMusic", trackId = undefined, UAPool case "QQMusic": default: { const lyricUrl = new URL("https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg"); - lyricUrl.searchParams.set("g_tk", "5381"); + lyricUrl.searchParams.set("g_tk", 5381); lyricUrl.searchParams.set("format", "json"); - lyricUrl.searchParams.set("nobase64", "1"); + lyricUrl.searchParams.set("nobase64", 1); lyricUrl.searchParams.set("songmid", trackId); // trackInfo.QQMusic.mid log(`🚧 lyricUrl: ${lyricUrl.toJSON()}`, ""); Request.url = lyricUrl.toString(); @@ -499,8 +498,8 @@ async function searchLyric(vendor = "NeteaseMusic", trackId = undefined, UAPool break; } } - log("✅ Search Lyric", ""); log("🚧 Search Lyric", `Lyrics: ${JSON.stringify(Lyrics)}`, ""); + log("✅ Search Lyric", ""); return Lyrics; } diff --git a/src/External.Lyrics.response.js b/src/External.Lyrics.response.js index b165b24d..ad255520 100644 --- a/src/External.Lyrics.response.js +++ b/src/External.Lyrics.response.js @@ -1,5 +1,4 @@ import { $app, Lodash as _, Storage, fetch, notification, log, logError, wait, done } from "@nsnanocat/util"; -import { URL } from "@nsnanocat/url"; import LRC from "./LRC/LRC.mjs"; import database from "./database/index.mjs"; import setENV from "./function/setENV.mjs"; @@ -286,9 +285,9 @@ async function searchTrack(vendor = "NeteaseMusic", keyword = "", UAPool = []) { switch (vendor) { case "NeteaseMusic": { const searchUrl = new URL("https://music.163.com/api/cloudsearch/pc"); - searchUrl.searchParams.set("type", "1"); - searchUrl.searchParams.set("limit", "1"); - searchUrl.searchParams.set("offset", "0"); + searchUrl.searchParams.set("type", 1); + searchUrl.searchParams.set("limit", 1); + searchUrl.searchParams.set("offset", 0); searchUrl.searchParams.set("s", keyword); Request.url = searchUrl.toString(); Request.headers.Referer = "https://music.163.com"; @@ -310,9 +309,9 @@ async function searchTrack(vendor = "NeteaseMusic", keyword = "", UAPool = []) { ]; // 搜索歌曲 const searchUrl = new URL(`https://${HostPool[Math.floor(Math.random() * HostPool.length)]}/cloudsearch`); - searchUrl.searchParams.set("type", "1"); - searchUrl.searchParams.set("limit", "1"); - searchUrl.searchParams.set("offset", "0"); + searchUrl.searchParams.set("type", 1); + searchUrl.searchParams.set("limit", 1); + searchUrl.searchParams.set("offset", 0); searchUrl.searchParams.set("keywords", keyword); Request.url = searchUrl.toString(); Request.headers.Referer = "https://music.163.com"; @@ -365,9 +364,9 @@ async function searchLyric(vendor = "NeteaseMusic", trackId = undefined, UAPool case "NeteaseMusic": { const lyricUrl = new URL("https://music.163.com/api/song/lyric"); lyricUrl.searchParams.set("id", trackId); // trackInfo.NeteaseMusic.id - lyricUrl.searchParams.set("lv", "0"); - lyricUrl.searchParams.set("tv", "0"); - lyricUrl.searchParams.set("tv", "0"); + lyricUrl.searchParams.set("lv", -1); + lyricUrl.searchParams.set("yv", -1); + lyricUrl.searchParams.set("tv", -1); Request.url = lyricUrl.toString(); Request.headers.Referer = "https://music.163.com"; Request.headers.Cookie = "os=ios; __remember_me=true; NMTID=xxx"; @@ -402,9 +401,9 @@ async function searchLyric(vendor = "NeteaseMusic", trackId = undefined, UAPool case "QQMusic": default: { const lyricUrl = new URL("https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg"); - lyricUrl.searchParams.set("g_tk", "5381"); + lyricUrl.searchParams.set("g_tk", 5381); lyricUrl.searchParams.set("format", "json"); - lyricUrl.searchParams.set("nobase64", "1"); + lyricUrl.searchParams.set("nobase64", 1); lyricUrl.searchParams.set("songmid", trackId); // trackInfo.QQMusic.mid Request.url = lyricUrl.toString(); Request.headers.Referer = "https://lyric.music.qq.com";