Installed escape-string-regexp

This commit is contained in:
freearhey 2019-10-23 13:52:01 +03:00
parent 3c5ea29926
commit 321f85ad53
3 changed files with 9 additions and 0 deletions

View file

@ -1,4 +1,5 @@
const util = require('./util')
const escapeStringRegexp = require('escape-string-regexp')
const debug = false
const verbose = false
@ -83,6 +84,7 @@ async function main() {
for(let channelId in buffer[epgUrl].channels) {
let c = buffer[epgUrl].channels[channelId]
for(let epgName of c.names) {
epgName = escapeStringRegexp(epgName)
channelTitle = channel.title.replace(/(fhd|hd|sd|高清)$/i, '').trim()
let regexp = new RegExp(`^${epgName}$`, 'i')
if(regexp.test(channelTitle)) {