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

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

    @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)[^>]*\bplayback-id=[^>]+>', webpage):
            playback_id = traverse_obj(mux_player, ({extract_attributes}, 'playback-id'))
            if not playback_id:
                continue
            token = traverse_obj(mux_player, ({extract_attributes}, 'playback-token'))
            if '?' in playback_id:
                playback_id, qs = playback_id.split('?', 1)
                token = token or traverse_obj(urllib.parse.parse_qs(qs), ('token', 0))
            yield f'https://player.mux.com/{playback_id}{"?playback-token=" + token if token else ""}'

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

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

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
            f'https://stream.mux.com/{video_id}.m3u8', video_id, 'mp4',
            query=filter_dict({'token': token}))

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


Review comment (suggestion):
```suggestion
        for mux_player in re.findall(r'<mux-(?:player|video)\b[^>]*\bplayback-id=[^>]+>', webpage):
```

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

    @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'):