Skip to content

Commit

Permalink
fix(External.Lyrics.response)
Browse files Browse the repository at this point in the history
Update External.Lyrics.response.dev.js
Update External.Lyrics.response.js
Update CHANGELOG.md
Update package.json
  • Loading branch information
VirgilClyne committed Nov 21, 2024
1 parent 36c7d70 commit c99e730
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 37 deletions.
12 changes: 3 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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”使用",
Expand Down
29 changes: 14 additions & 15 deletions src/External.Lyrics.response.dev.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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()}`, "");
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}

Expand Down
23 changes: 11 additions & 12 deletions src/External.Lyrics.response.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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";
Expand All @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit c99e730

Please sign in to comment.