mirror of
https://github.com/iptv-org/iptv
synced 2026-10-22 02:56:48 -04:00
Update playlistParser.ts
Fixes https://github.com/iptv-org/iptv/issues/17533
This commit is contained in:
1 parent
9672a1f439
commit
fbeb5c3d8d
1 file changed
+8
-3
@@ -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, '\\$&')
|
||||
}
|
||||
Reference in new issue
Block a user