From 7ab4cf525ce836771618ed0867f08722ab2b82f7 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 11 Feb 2022 10:09:25 +0300 Subject: [PATCH] Create blocklist.js --- scripts/core/blocklist.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/core/blocklist.js diff --git a/scripts/core/blocklist.js b/scripts/core/blocklist.js new file mode 100644 index 0000000000..ab2502c39f --- /dev/null +++ b/scripts/core/blocklist.js @@ -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