mirror of
https://github.com/iptv-org/iptv
synced 2026-09-09 13:27:58 -04:00
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:
@@ -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 }
|
||||
|
||||
@@ -9,6 +9,16 @@
|
||||
"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,
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
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="",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
|
||||
|
||||
@@ -19,6 +19,7 @@ describe('playlist:export', () => {
|
||||
content('tests/__data__/expected/playlist_export/.api/streams.json')
|
||||
)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
function content(filepath: string) {
|
||||
|
||||
Reference in New Issue
Block a user