Restrict parsed stream quality suffixes (#49869)

* fix: restrict parsed stream quality suffixes

* test: reuse playlist export fixture for quality suffix
This commit is contained in:
chen zhihao
2026-09-04 09:28:26 +02:00
committed by GitHub
parent 1e283edf33
commit f3ef256bdf
4 changed files with 26 additions and 13 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ export class Stream extends sdk.Models.Stream {
let title = name
const [, label] = title.match(/ \[(.*)\]$/) || [null, '']
title = title.replace(new RegExp(` \\[${escapeRegExp(label)}\\]$`), '')
const [, quality] = title.match(/ \(([0-9]+[p|i])\)$/) || [null, '']
const [, quality] = title.match(/ \(([0-9]+[pi])\)$/) || [null, '']
title = title.replace(new RegExp(` \\(${quality}\\)$`), '')
return { title, label, quality }
@@ -1,15 +1,25 @@
[
{
"channel": null,
"feed": null,
"title": "Daawah TV",
{
"channel": null,
"feed": null,
"title": "Daawah TV",
"url": "http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8",
"referrer": null,
"user_agent": null,
"quality": null,
"label": null
},
{
"quality": null,
"label": null
},
{
"channel": null,
"feed": null,
"title": "Example (720|)",
"url": "https://example.com/live.m3u8",
"referrer": null,
"user_agent": null,
"quality": null,
"label": null
},
{
"channel": null,
"feed": null,
"title": "Andorra TV",
@@ -79,4 +89,4 @@
"quality": "720p",
"label": null
}
]
]
@@ -1,9 +1,11 @@
#EXTM3U
#EXTINF:-1 tvg-id="LDPRTV.ru",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/blocked.m3u8
#EXTINF:-1 tvg-id="VisitXTV.nl",Visit-X TV
https://stream.visit-x.tv/vxtv/ngrp:live_all/30fps.m3u8
#EXTINF:-1 tvg-id="" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",Andorra TV (720p) [Not 24/7]
#EXTINF:-1 tvg-id="VisitXTV.nl",Visit-X TV
https://stream.visit-x.tv/vxtv/ngrp:live_all/30fps.m3u8
#EXTINF:-1 tvg-id="",Example (720|)
https://example.com/live.m3u8
#EXTINF:-1 tvg-id="" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",Andorra TV (720p) [Not 24/7]
#EXTVLCOPT:http-referrer=http://imn.iq
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index2.m3u8
+1
View File
@@ -19,6 +19,7 @@ describe('playlist:export', () => {
content('tests/__data__/expected/playlist_export/.api/streams.json')
)
})
})
function content(filepath: string) {