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

Code before:
import re

from .common import InfoExtractor


class MixlrIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?(?P<username>[\w-]+)\.mixlr\.com/events/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://suncity-104-9fm.mixlr.com/events/4261962',
        'info_dict': {
            'id': '4261962',
            'title': re.compile(r'.+'),
            'description': re.compile(r'.+'),
            'ext': 'mp3',
            'is_live': True,
            'uploader': 'suncity-104-9fm',
        },
        'skip': 'Live broadcast may not be available',
    }]

    def _real_extract(self, url):
        mobj = self._match_valid_url(url)
        username = mobj.group('username')
        event_id = mobj.group('id')

        api_url = f'https://apicdn.mixlr.com/v3/channel_view/{username}'
        channel_info = self._download_json(api_url, event_id)
        user_data = channel_info.get('data', {}).get('attributes', {})

        broadcast_data = None
        event_data = None
        included = channel_info.get('included', [])
        for item in included:
            if item.get('type') == 'broadcast':
                broadcast_data = item.get('attributes', {})
            elif item.get('type') == 'event' and item.get('id') == event_id:
                event_data = item.get('attributes', {})

            if broadcast_data and event_data:
                break

        if not broadcast_data or not broadcast_data.get('live', False):
            self.raise_no_formats('No active broadcast found', expected=True)

Review comment (suggestion):
I know they will expire, still wanted to add one test for mp3 and one for aac
```suggestion
    _TESTS = [{
        'url': 'https://suncity-104-9fm.mixlr.com/events/4387115',
        'info_dict': {
            'id': '4387115',
            'ext': 'mp3',
            'title': r're:SUNCITY 104.9FM\'s live audio \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
            'uploader': 'suncity-104-9fm',
            'like_count': int,
            'thumbnail': r're:https://imagecdn\.mixlr\.com/cdn-cgi/image/[^/?#]+/cd5b34d05fa2cee72d80477724a2f02e.png',
            'timestamp': 1751943773,
            'upload_date': '20250708',
            'release_timestamp': 1751943764,
            'release_date': '20250708',
            'live_status': 'is_live',
        },
    }, {
        'url': 'https://brcountdown.mixlr.com/events/4395480',
        'info_dict': {
            'id': '4395480',
            'ext': 'aac',
            'title': r're:Beats Revolution Countdown Episodio 461 \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
            'description': 'md5:5cacd089723f7add3f266bd588315bb3',
            'uploader': 'brcountdown',
            'like_count': int,
            'thumbnail': r're:https://imagecdn\.mixlr\.com/cdn-cgi/image/[^/?#]+/c48727a59f690b87a55d47d123ba0d6d.jpg',
            'timestamp': 1752354007,
            'upload_date': '20250712',
            'release_timestamp': 1752354000,
            'release_date': '20250712',
            'live_status': 'is_live',
        },
```

Code after:
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, parse_iso8601, url_or_none, urlhandle_detect_ext
from ..utils.traversal import traverse_obj


class MixlrIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?(?P<username>[\w-]+)\.mixlr\.com/events/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://suncity-104-9fm.mixlr.com/events/4387115',
        'info_dict': {
            'id': '4387115',
            'ext': 'mp3',
            'title': r're:SUNCITY 104.9FM\'s live audio \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
            'uploader': 'suncity-104-9fm',
            'like_count': int,
            'thumbnail': r're:https://imagecdn\.mixlr\.com/cdn-cgi/image/[^/?#]+/cd5b34d05fa2cee72d80477724a2f02e.png',
            'timestamp': 1751943773,
            'upload_date': '20250708',
            'release_timestamp': 1751943764,
            'release_date': '20250708',
            'live_status': 'is_live',
        },
    }, {
        'url': 'https://brcountdown.mixlr.com/events/4395480',
        'info_dict': {
            'id': '4395480',
            'ext': 'aac',
            'title': r're:Beats Revolution Countdown Episodio 461 \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
            'description': 'md5:5cacd089723f7add3f266bd588315bb3',
            'uploader': 'brcountdown',
            'like_count': int,
            'thumbnail': r're:https://imagecdn\.mixlr\.com/cdn-cgi/image/[^/?#]+/c48727a59f690b87a55d47d123ba0d6d.jpg',
            'timestamp': 1752354007,
            'upload_date': '20250712',
            'release_timestamp': 1752354000,
            'release_date': '20250712',
            'live_status': 'is_live',
        },
    }, {
        'url': 'https://www.brcountdown.mixlr.com/events/4395480',
        'only_matching': True,
    }]