mirror of
https://github.com/iptv-org/iptv.git
synced 2024-12-26 09:26:36 +00:00
Update playlistParser.ts
Fixes https://github.com/iptv-org/iptv/issues/17533
This commit is contained in:
parent
51d6244418
commit
57ad6f4e0b
|
@ -53,8 +53,13 @@ export class PlaylistParser {
|
|||
|
||||
function parseTitle(title: string): { name: string; label: string; quality: string } {
|
||||
const [, label] = title.match(/ \[(.*)\]$/) || [null, '']
|
||||
const [, quality] = title.match(/ \(([0-9]+p)\)/) || [null, '']
|
||||
const name = title.replace(` (${quality})`, '').replace(` [${label}]`, '')
|
||||
title = title.replace(new RegExp(` \\[${escapeRegExp(label)}\\]$`), '')
|
||||
const [, quality] = title.match(/ \(([0-9]+p)\)$/) || [null, '']
|
||||
title = title.replace(new RegExp(` \\(${quality}\\)$`), '')
|
||||
|
||||
return { name, label, quality }
|
||||
return { name: title, label, quality }
|
||||
}
|
||||
|
||||
function escapeRegExp(text) {
|
||||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue