mirror of
https://github.com/Moe-Sakura/Wrangler-API.git
synced 2026-03-15 04:13:18 +08:00
fix: 修复 VikaACG 搜索结果中的 Unicode 转义字符
* 解决 VikaACG 平台搜索结果中 `\uXXXX` Unicode 转义字符未正确解码的问题。 * 新增逻辑将 `\uXXXX` 转义序列转换为实际字符,确保搜索结果内容正确显示。
This commit is contained in:
@@ -49,7 +49,10 @@ async function searchVikaACG(game: string): Promise<PlatformSearchResult> {
|
||||
// .json() will parse the JSON and unescape the string content.
|
||||
const html: string = await response.text();
|
||||
|
||||
const matches = html.replaceAll('\\/', '/').replaceAll('\\\\', '\\').replaceAll('\\"', '"').matchAll(REGEX);
|
||||
const decodedHtml = html.replaceAll('\\/', '/').replaceAll('\\\\', '\\').replaceAll('\\"', '"').replace(/\\u([\d\w]{4})/gi, (match, grp) => {
|
||||
return String.fromCharCode(parseInt(grp, 16));
|
||||
});
|
||||
const matches = decodedHtml.matchAll(REGEX);
|
||||
|
||||
const items: SearchResultItem[] = [];
|
||||
for (const match of matches) {
|
||||
|
||||
Reference in New Issue
Block a user