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

Code before:
from .common import InfoExtractor


class MuxStreamNewIE(InfoExtractor):
    IE_NAME = 'stream.new'
    _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/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)

        formats = self._extract_m3u8_formats(
            f'https://stream.mux.com/{video_id}.m3u8', video_id, 'mp4')

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


Review comment (refactor):
I would expand the embed detection to detect `<mux-player>` web components like used here https://muxvideo.2coders.com/download/ (please also add as a test)
```suggestion
    @classmethod
    def _extract_embed_urls(cls, url, webpage):
        yield from super()._extract_embed_urls(url, webpage)

        for playback_id in re.findall(r'<mux-player[^>]*\bplayback-id=["\'](?P<id>[A-Za-z0-9-]+)', webpage):
            yield f'https://player.mux.com/{playback_id}'
```

Code after:
    _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',
        },
    }]

    @classmethod
    def _extract_embed_urls(cls, url, webpage):
        yield from super()._extract_embed_urls(url, webpage)
        for mux_player in re.findall(r'<mux-(?:player|video)\b[^>]*\bplayback-id=[^>]+>', webpage):
            attrs = extract_attributes(mux_player)
            playback_id = attrs.get('playback-id')
            if not playback_id:
                continue
            token = attrs.get('playback-token') or traverse_obj(playback_id, ({parse_qs}, 'token', -1))
            playback_id = playback_id.partition('?')[0]

            embed_url = update_url_query(
                f'https://player.mux.com/{playback_id}',
                filter_dict({'playback-token': token}))
            if title := attrs.get('metadata-video-title'):
                embed_url = smuggle_url(embed_url, {'title': title})
            yield embed_url

    def _real_extract(self, url):
        url, smuggled_data = unsmuggle_url(url, {})
        video_id = self._match_id(url)

        token = traverse_obj(parse_qs(url), ('playback-token', -1))

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(