feat: 角色下载脚本适配原神和星穹铁道

This commit is contained in:
2026-08-05 21:57:29 +08:00
parent e1c9bda4e1
commit 09a652fcd6
2 changed files with 51 additions and 5 deletions
+2 -1
View File
@@ -10,7 +10,8 @@ function cleanImageUrl(url) {
function generateImageName(url) {
const fileNameMatch = url.match(/\/([^/]+)\.png/i);
if (fileNameMatch && fileNameMatch[1]) {
return fileNameMatch[1].toLowerCase().replace(/_/g, '-');
// 去除 .、&、(、) 等特殊字符
return fileNameMatch[1].toLowerCase().replace(/_/g, '-').replaceAll(/\.|%26|%28|%29|%e2%80%a2/g, "").replace(/-{2,}/g, '-');
}
return null;
}