mirror of
https://github.com/iptv-org/iptv
synced 2025-12-17 02:47:33 -05:00
Update playlistParser.ts
Fixes https://github.com/iptv-org/iptv/issues/17533
This commit is contained in:
@@ -53,8 +53,13 @@ export class PlaylistParser {
|
|||||||
|
|
||||||
function parseTitle(title: string): { name: string; label: string; quality: string } {
|
function parseTitle(title: string): { name: string; label: string; quality: string } {
|
||||||
const [, label] = title.match(/ \[(.*)\]$/) || [null, '']
|
const [, label] = title.match(/ \[(.*)\]$/) || [null, '']
|
||||||
const [, quality] = title.match(/ \(([0-9]+p)\)/) || [null, '']
|
title = title.replace(new RegExp(` \\[${escapeRegExp(label)}\\]$`), '')
|
||||||
const name = title.replace(` (${quality})`, '').replace(` [${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