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)) {

6
package-lock.json generated
View File

@ -47,6 +47,12 @@
"xregexp": "^4.2.4"
}
},
"escape-string-regexp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",
"integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==",
"dev": true
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",

View File

@ -12,6 +12,7 @@
"dependencies": {},
"devDependencies": {
"axios": ">=0.18.1",
"escape-string-regexp": "^2.0.0",
"iptv-playlist-parser": "^0.2.2",
"markdown-include": "^0.4.3",
"xmldom": "^0.1.27"