Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/mux.py (Python)

Code before:
    IE_NAME = 'stream.new'
    _WORKING = True
    _VALID_URL = r'https?://stream.new/v/(?P<id>[A-Za-z0-9-]+)(/embed)?'
    _TESTS = [{
        'url': 'https://stream.new/v/36d8c00L1vEFwF01aF1cRKQs8nblgegMda8YR9CE3wejk/embed',
        'info_dict': {
            'id': '36d8c00L1vEFwF01aF1cRKQs8nblgegMda8YR9CE3wejk',
            'title': '36d8c00L1vEFwF01aF1cRKQs8nblgegMda8YR9CE3wejk',
            'formats': 'mincount:1',
            'ext': 'mp4',
            '_type': 'video',
        },
        'params': {
            # m3u8 download
            'skip_download': True,
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)

        video_url = 'https://stream.mux.com/%s.m3u8' % video_id

        formats = self._extract_m3u8_formats(
            video_url, video_id, 'mp4',
            entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)

        return {
            'id': video_id,
            'title': video_id,
            'formats': formats,
            '_type': 'video',
        }


Review comment (refactor):
Use f-string. Why should this be non-fatal? `entry_protocol='m3u8_native' is the default
```suggestion
        formats = self._extract_m3u8_formats(
            f'https://stream.mux.com/{video_id}.m3u8', video_id, 'mp4')
```

Code after:
    extract_attributes,
    filter_dict,
    parse_qs,
    smuggle_url,
    unsmuggle_url,
    update_url_query,
)
from ..utils.traversal import traverse_obj


class MuxIE(InfoExtractor):
    _VALID_URL = r'https?://(?:stream\.new/v|player\.mux\.com)/(?P<id>[A-Za-z0-9-]+)'
    _EMBED_REGEX = [r'<iframe\b[^>]+\bsrc=["\'](?P<url>(?:https?:)?//(?:stream\.new/v|player\.mux\.com)/(?P<id>[A-Za-z0-9-]+)[^"\']+)']
    _TESTS = [{
        'url': 'https://stream.new/v/OCtRWZiZqKvLbnZ32WSEYiGNvHdAmB01j/embed',
        'info_dict': {
            'ext': 'mp4',
            'id': 'OCtRWZiZqKvLbnZ32WSEYiGNvHdAmB01j',
            'title': 'OCtRWZiZqKvLbnZ32WSEYiGNvHdAmB01j',
        },
    }, {
        'url': 'https://player.mux.com/OCtRWZiZqKvLbnZ32WSEYiGNvHdAmB01j',
        'info_dict': {
            'ext': 'mp4',
            'id': 'OCtRWZiZqKvLbnZ32WSEYiGNvHdAmB01j',
            'title': 'OCtRWZiZqKvLbnZ32WSEYiGNvHdAmB01j',
        },
    }]
    _WEBPAGE_TESTS = [{
        # iframe embed
        'url': 'https://www.redbrickai.com/blog/2025-07-14-FAST-brush',
        'info_dict': {
            'ext': 'mp4',
            'id': 'cXhzAiW1AmsHY01eRbEYFcTEAn0102aGN8sbt8JprP6Dfw',
            'title': 'cXhzAiW1AmsHY01eRbEYFcTEAn0102aGN8sbt8JprP6Dfw',
        },
    }, {
        # mux-player embed
        'url': 'https://muxvideo.2coders.com/download/',
        'info_dict': {
            'ext': 'mp4',
            'id': 'JBuasdg35Hw7tYmTe9k68QLPQKixL300YsWHDz5Flit8',
            'title': 'JBuasdg35Hw7tYmTe9k68QLPQKixL300YsWHDz5Flit8',
        },
    }, {
        # mux-player with title metadata
        'url': 'https://datastar-todomvc.cross.stream/',
        'info_dict': {
            'ext': 'mp4',
            'id': 'KX01ZSZ8CXv5SVfVwMZKJTcuBcUQmo1ReS9U5JjoHm4k',
            'title': 'TodoMVC with Datastar Tutorial',