From 5400ce3c836037389f65371aeb0d06a01a43352e Mon Sep 17 00:00:00 2001 From: sepro Date: Wed, 24 Sep 2025 00:48:17 +0200 Subject: [PATCH] improve regex --- yt_dlp/extractor/tenplay.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/tenplay.py b/yt_dlp/extractor/tenplay.py index 6734c0b27..9a6d76273 100644 --- a/yt_dlp/extractor/tenplay.py +++ b/yt_dlp/extractor/tenplay.py @@ -231,9 +231,9 @@ class TenPlayIE(InfoExtractor): fmt['hls_media_playlist_data'] = m3u8_doc # Attempt format upgrade - if m3u8_doc and re.search(r'(?m)-(300|150|75|55)0000-(\d+)\.ts$', m3u8_doc): - m3u8_doc = re.sub(r'(?m)-(300|150|75|55)0000-(\d+)\.ts$', r'-5000000-\2.ts', m3u8_doc) - m3u8_doc = re.sub(r'-(300|150|75|55)0000\.key"', r'-5000000.key"', m3u8_doc) + if m3u8_doc and re.search(r'(?m)-(?:300|150|75|55)0000-\d+\.ts$', m3u8_doc): + m3u8_doc = re.sub(r'(?m)-(?:300|150|75|55)0000-(\d+)\.ts$', r'-5000000-\1.ts', m3u8_doc) + m3u8_doc = re.sub(r'-(?:300|150|75|55)0000\.key"', r'-5000000.key"', m3u8_doc) formats.append({ 'format_id': 'hls-1080p', 'url': formats[0]['url'],