Skip to content

Commit

Permalink
fix(Translate.response): YouTube Music
Browse files Browse the repository at this point in the history
Update Translate.response.dev.js
Update Translate.response.js
Update CHANGELOG.md
  • Loading branch information
VirgilClyne committed Nov 10, 2024
1 parent d56a2e2 commit a49ad76
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
7 changes: 1 addition & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
### 🛠️ Bug Fixes
* 修复 `External.Lyrics.response` 发送请求时错误将字符串 `encodeURIComponent` 两次的问题
* 修复 `Translate.response` 未能成功识别翻译 `YouTube Music` app 歌词的问题

### 🔣 Dependencies
* 升级了 `@nsnanocat/util`
* `$platform` 改为 `$app`
* 增加了 `@nsnanocat/url`
* 使用了全新的 `URL``URLSearchParams` polyfill

### 🔄 Other Changes
* 重构了 `detectPlatform`
6 changes: 3 additions & 3 deletions src/Translate.response.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ log(`⚠ FORMAT: ${FORMAT}`, "");
});
}
Languages[0] = "AUTO";
if (body?.contents?.elementRenderer?.n7F172660663?.n8F1?.n9F168777401?.n10F5?.n11F465160965?.n12F4?.n13F1) {
const fullText = body.contents.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1.map(line => line?.f1 ?? "\u200b");
if (body?.contents?.renderer?.elementRenderer?.n7F172660663?.n8F1?.n9F168777401?.n10F5?.n11F465160965?.n12F4?.n13F1) {
const fullText = body.contents.renderer.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1.map(line => line?.f1 ?? "\u200b");
const translation = await Translator(Settings.Vendor, Settings.Method, fullText, Languages, Settings?.[Settings?.Vendor], Settings?.Times, Settings?.Interval, Settings?.Exponential);
body.contents.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1 = body.contents.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1.map((line, i) => {
body.contents.renderer.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1 = body.contents.renderer.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1.map((line, i) => {
if (line?.f1) line.f1 = combineText(line.f1, translation?.[i], Settings?.ShowOnly, Settings?.Position);
return line;
});
Expand Down
6 changes: 3 additions & 3 deletions src/Translate.response.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ log(`⚠ FORMAT: ${FORMAT}`, "");
case "YouTube": {
body = BrowseResponse.fromBinary(rawBody);
Languages[0] = "AUTO";
if (body?.contents?.elementRenderer?.n7F172660663?.n8F1?.n9F168777401?.n10F5?.n11F465160965?.n12F4?.n13F1) {
const fullText = body.contents.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1.map(line => line?.f1 ?? "\u200b");
if (body?.contents?.renderer?.elementRenderer?.n7F172660663?.n8F1?.n9F168777401?.n10F5?.n11F465160965?.n12F4?.n13F1) {
const fullText = body.contents.renderer.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1.map(line => line?.f1 ?? "\u200b");
const translation = await Translator(Settings.Vendor, Settings.Method, fullText, Languages, Settings?.[Settings?.Vendor], Settings?.Times, Settings?.Interval, Settings?.Exponential);
body.contents.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1 = body.contents.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1.map((line, i) => {
body.contents.renderer.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1 = body.contents.renderer.elementRenderer.n7F172660663.n8F1.n9F168777401.n10F5.n11F465160965.n12F4.n13F1.map((line, i) => {
if (line?.f1) line.f1 = combineText(line.f1, translation?.[i], Settings?.ShowOnly, Settings?.Position);
return line;
});
Expand Down

0 comments on commit a49ad76

Please sign in to comment.