-
Notifications
You must be signed in to change notification settings - Fork 4
/
song_replace.js
136 lines (132 loc) · 3.83 KB
/
song_replace.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
function songReplace(name) {
return [
songReplace1(name),
songReplace2(name),
songReplace3(name),
]
}
function songReplace1(name) {
let a = name
let result
a = a.replace(/ -.*/gm, ``)
a = a.replace(/ ~.*/gm, ``)
a = a.replace(/\/.*/, ``)
if ((/.*?/.*?/.*/gm).test(a)) {
a = a.replace(/.*?//, ``)
a = a.replace(/『.*/, ``)
}
a = a.replace(/(.*?(\\.|[^)]))/gm, ``)
a = a.replace(/\(.*?(\\.|[^)])\)/gm, ``)
a = a.replace(/[^]*(\\.|[^『])『/gm, ``).replace(/』[^]*/gm, ``)
a = a.replace(/【.*?】/g, ``)
a = a.replace(/[^]*(\\.|[^/])//gm, ``)
a = a.replace(/[^]*(\\.|[^「])「/gm, ``).replace(/」[^]*/gm, ``)
a = a.replace(/"/gm, ``)
a = a.replace(/\[[^]*/gm, ``)
if ((/.*?-([^-].*?)-.*/gm).test(a)) {
result = a.replace(/.*?- /, ``).replace(/ -.*/, ``)
return result
} else {
a = a.replace(/.* -/g, ``)
}
a = a.replace(/ but .*/g, ``)
a = a.replace((/.*(\s{0,})/).exec(a)[1], ``)
a = a.replace((/(\s{0,}).*/).exec(a)[1], ``)
result = a.replace(/(.*/gm, ``)
return result
}
function songReplace2(name) {
let a = name
let result
a = a.replace(`「`, ``).replace(/」[^]*/gm, ``)
if ((/.*?/.*?/.*/gm).test(a)) {
a = a.replace(//.*/, ``)
a = a.replace(/』.*/, ``)
a = a.replace(/.*『/, ``)
}
if ((/.*『.*』.*-.*/.*/gm).test(a)) {
a = a.replace(//.*/g, ``).replace(/ -.*/, ``).replace(/.*』/, ``)
} else {
a = a.replace(/[^]*(\\.|[^『])『/gm, ``).replace(/』[^]*/gm, ``)
}
a = a.replace(/.*\//, ``)
a = a.replace(/(.*?(\\.|[^)]))/gm, ``)
a = a.replace(/\(.*?(\\.|[^)])\)/gm, ``)
a = a.replace(/【.*?(\\.|[^】])】/gm, ``)
a = a.replace(/.*:: /gm, ``)
a = a.replace(/[^]*(\\.|[^/])//gm, ``)
a = a.replace(/[^]*(\\.|[^「])「/gm, ``).replace(/」[^]*/gm, ``)
a = a.replace(/"/gm, ``)
a = a.replace(/\[[^]*/gm, ``)
if ((/.*?-([^-].*?)-.*/gm).test(a)) {
result = a.replace(/ -.*/, ``)
return result
} else {
a = a.replace(/.* -/g, ``)
}
a = a.replace(`-`, ``)
a = a.replace(/ & .*/gm, ``)
a = a.replace(/[^a-zA-Z0-9!?あ-んA-Za-z一-青\sーア-ンア-ン]*/gm, ``)
if ((/\s.*/).test(a)) {
a = a.replace(/\s/, ``)
} else if ((/ .*/).test(a)) {
a = a.replace(/ /, ``)
}
a = a.replace(/(.*/g, ``)
if (a !== `Intro`) {
a = a.replace(`Intro`, ``)
}
a = a.replace(/\s*(b|B)y.*/g, ``)
a = a.replace(/ but .*/g, ``)
a = a.replace((/.*(\s{0,})/).exec(a)[1], ``)
a = a.replace((/(\s{0,}).*/).exec(a)[1], ``)
result = a
return result
}
function songReplace3(name) {
const songname = name
let a = songname
let result
if ((/(\(|)feat. .*/g).test(a)) {
a = (/(.*) (\(|)feat. /g).exec(a)[1]
a = a.replace(/「.*」/, ``)
return a
}
a = a.replace(`「`, ``).replace(/」[^]*/gm, ``)
if ((/.*『.*』.*-.*/.*/gm).test(a)) {
a = a.replace(//.*/g, ``).replace(/[^]*(\\.|[^- ])*- /gm, ``)
} else {
a = a.replace(/[^]*(\\.|[^『])『/gm, ``).replace(/』[^]*/gm, ``)
}
a = a.replace(/【.*?】/g, ``)
a = a.replace(/[^]*(\\.|[^/])//gm, ``)
a = a.replace(/[^]*(\\.|[^「])「/gm, ``).replace(/」[^]*/gm, ``)
a = a.replace(/".*?"/gm, ``)
a = a.replace(/\[[^]*/gm, ``)
if ((/.*?-([^-].*?)-.*/gm).test(a)) {
result = a.replace(/.*- /, ``)
return result
} else {
a = a.replace(/.* -/g, ``)
}
a = a.replace(/.* & /gm, ``)
a = a.replace(/-.*/, ``)
a = a.replace(/ /gm, ``)
a = a.replace(/([!]*)/gm, ``)
a = a.replace(/[^a-zA-Z0-9\s]*/gm, ``)
a = a.replace(/ feat.*/gm, ``)
if (a !== `Extended`) {
a = a.replace(`Extended`, ``)
}
a = a.replace(/ but .*/g, ``)
a = a.replace((/.*(\s{0,})/).exec(a)[1], ``)
a = a.replace((/(\s{0,}).*/).exec(a)[1], ``)
result = a.replace(/(.*/gm, ``)
return result
}
module.exports = {
songReplace,
songReplace1,
songReplace2,
songReplace3,
}