Update filter.js
This commit is contained in:
parent
a9ebb223e6
commit
f1d5acdc0b
@ -21,11 +21,9 @@ async function main() {
|
|||||||
|
|
||||||
function removeBlacklisted(playlist) {
|
function removeBlacklisted(playlist) {
|
||||||
const channels = playlist.channels.filter(channel => {
|
const channels = playlist.channels.filter(channel => {
|
||||||
const channelName = normalizeName(channel.name)
|
|
||||||
return !blacklist.find(item => {
|
return !blacklist.find(item => {
|
||||||
const hasSameName =
|
const regexp = new RegExp(item.regex, 'i')
|
||||||
normalizeName(item.name) === channelName ||
|
const hasSameName = regexp.test(channel.name)
|
||||||
item.aliases.map(alias => normalizeName(alias)).includes(channelName)
|
|
||||||
const fromSameCountry = playlist.country.code === item.country
|
const fromSameCountry = playlist.country.code === item.country
|
||||||
|
|
||||||
return hasSameName && fromSameCountry
|
return hasSameName && fromSameCountry
|
||||||
@ -41,8 +39,4 @@ function removeBlacklisted(playlist) {
|
|||||||
return playlist
|
return playlist
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeName(str) {
|
|
||||||
return str.replace(/[^a-zA-Z0-9 ]/gi, '').toLowerCase()
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user