Create blocklist.js
This commit is contained in:
parent
2f99170a15
commit
7ab4cf525c
18
scripts/core/blocklist.js
Normal file
18
scripts/core/blocklist.js
Normal 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
|
Loading…
Reference in New Issue
Block a user