Installed escape-string-regexp
This commit is contained in:
parent
3c5ea29926
commit
321f85ad53
|
@ -1,4 +1,5 @@
|
||||||
const util = require('./util')
|
const util = require('./util')
|
||||||
|
const escapeStringRegexp = require('escape-string-regexp')
|
||||||
|
|
||||||
const debug = false
|
const debug = false
|
||||||
const verbose = false
|
const verbose = false
|
||||||
|
@ -83,6 +84,7 @@ async function main() {
|
||||||
for(let channelId in buffer[epgUrl].channels) {
|
for(let channelId in buffer[epgUrl].channels) {
|
||||||
let c = buffer[epgUrl].channels[channelId]
|
let c = buffer[epgUrl].channels[channelId]
|
||||||
for(let epgName of c.names) {
|
for(let epgName of c.names) {
|
||||||
|
epgName = escapeStringRegexp(epgName)
|
||||||
channelTitle = channel.title.replace(/(fhd|hd|sd|高清)$/i, '').trim()
|
channelTitle = channel.title.replace(/(fhd|hd|sd|高清)$/i, '').trim()
|
||||||
let regexp = new RegExp(`^${epgName}$`, 'i')
|
let regexp = new RegExp(`^${epgName}$`, 'i')
|
||||||
if(regexp.test(channelTitle)) {
|
if(regexp.test(channelTitle)) {
|
||||||
|
|
|
@ -47,6 +47,12 @@
|
||||||
"xregexp": "^4.2.4"
|
"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": {
|
"follow-redirects": {
|
||||||
"version": "1.5.10",
|
"version": "1.5.10",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"axios": ">=0.18.1",
|
"axios": ">=0.18.1",
|
||||||
|
"escape-string-regexp": "^2.0.0",
|
||||||
"iptv-playlist-parser": "^0.2.2",
|
"iptv-playlist-parser": "^0.2.2",
|
||||||
"markdown-include": "^0.4.3",
|
"markdown-include": "^0.4.3",
|
||||||
"xmldom": "^0.1.27"
|
"xmldom": "^0.1.27"
|
||||||
|
|
Loading…
Reference in New Issue