Update filter.js

pull/4230/head
Aleksandr Statciuk 3 years ago
parent a9ebb223e6
commit f1d5acdc0b

@ -21,11 +21,9 @@ async function main() {
function removeBlacklisted(playlist) {
const channels = playlist.channels.filter(channel => {
const channelName = normalizeName(channel.name)
return !blacklist.find(item => {
const hasSameName =
normalizeName(item.name) === channelName ||
item.aliases.map(alias => normalizeName(alias)).includes(channelName)
const regexp = new RegExp(item.regex, 'i')
const hasSameName = regexp.test(channel.name)
const fromSameCountry = playlist.country.code === item.country
return hasSameName && fromSameCountry
@ -41,8 +39,4 @@ function removeBlacklisted(playlist) {
return playlist
}
function normalizeName(str) {
return str.replace(/[^a-zA-Z0-9 ]/gi, '').toLowerCase()
}
main()

Loading…
Cancel
Save