mirror of
https://github.com/iptv-org/iptv
synced 2025-12-17 02:47:33 -05:00
Create blocklist.js
This commit is contained in:
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
|
||||||
Reference in New Issue
Block a user