mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🎈 pref: 优化删除特殊符号逻辑
This commit is contained in:
parent
64135eae0f
commit
56333de309
@ -1248,7 +1248,7 @@ export class tools extends plugin {
|
||||
// 获取歌曲信息
|
||||
let title = await axios.get(AUTO_NETEASE_SONG_DETAIL.replace("{}", id)).then(res => {
|
||||
const song = res.data.songs[0];
|
||||
return `${ song?.name }-${ song?.ar?.[0].name }`.replace(/[\/\?<>\\:\*\|".… ]/g, "");
|
||||
return cleanFilename(`${ song?.name }-${ song?.ar?.[0].name }`);
|
||||
});
|
||||
// 一般这个情况是VIP歌曲 (如果没有url或者是国内, 国内全走临时接口,后续如果不要删除逻辑'!isOversea ||')
|
||||
if (!isOversea || url == null) {
|
||||
|
@ -427,14 +427,11 @@ export function saveJsonToFile(jsonData, filename = "data.json") {
|
||||
* @returns {string}
|
||||
*/
|
||||
export function cleanFilename(filename) {
|
||||
// 去除省略号(…)
|
||||
filename = filename.replace(/…/g, '');
|
||||
// 删除括号及其内容
|
||||
filename = filename.replace(/\(|\)/g, '');
|
||||
// 删除反斜杠
|
||||
filename = filename.replace(/\//g, '');
|
||||
|
||||
filename = filename.trim();
|
||||
// 1. 去除特殊字符
|
||||
// 2. 去除特定词汇
|
||||
filename = filename.replace(/[\/\?<>\\:\*\|".…《》()]/g, '')
|
||||
.replace(/电影|主题曲/g, '')
|
||||
.trim();
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user