Create blocklist.js

This commit is contained in:
Aleksandr Statciuk 2022-02-11 10:09:25 +03:00
parent 2f99170a15
commit 7ab4cf525c
1 changed files with 18 additions and 0 deletions

18
scripts/core/blocklist.js Normal file
View File

@ -0,0 +1,18 @@
const list = require('../data/blocklist')
const parser = require('./parser')
const blocklist = {}
blocklist.find = function (title, country) {
const name = parser.parseChannelName(title)
return list.find(item => {
const regexp = new RegExp(item.regex, 'i')
const hasSameName = regexp.test(name)
const fromSameCountry = country === item.country
return hasSameName && fromSameCountry
})
}
module.exports = blocklist