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

Code before:
        {
            'url': 'https://parti.com/video/66284',
            'info_dict': {
                'id': '66284',
                'ext': 'mp4',
                'title': 'NOW LIVE ',
                'upload_date': '20250327',
                'is_live': False,
                'categories': ['Gaming'],
                'thumbnail': 'https://assets.parti.com/351424_eb9e5250-2821-484a-9c5f-ca99aa666c87.png',
                'channel': 'ItZTMGG',
                'timestamp': 1743044379,
            },
            'params': {'skip_download': 'm3u8'},
        },
    ]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        data = self._call_api(f'get_livestream_channel_info/recent/{video_id}', video_id)
        formats = self._extract_m3u8_formats(
            urljoin('https://watch.parti.com', data['livestream_recording']), video_id, 'mp4')

        return {
            'id': video_id,
            'formats': formats,
            'is_live': False,
            **traverse_obj(data, {
                'title': ('event_title', {str}),
                'channel': ('user_name', {str}),
                'thumbnail': ('event_file', {url_or_none}),
                'categories': ('category_name', {str}, all),
                'timestamp': ('event_start_ts', {int_or_none}),
            }),
        }


class PartiLivestreamIE(PartiBaseIE):
    IE_NAME = 'parti:livestream'
    _VALID_URL = r'https?://(?:www\.)?parti\.com/creator/(?P<service>[\w]+)/(?P<id>[\w/-]+)'
    _TESTS = [
        {
            'url': 'https://parti.com/creator/parti/Capt_Robs_Adventures',
            'info_dict': {
                'id': 'Capt_Robs_Adventures',
                'ext': 'mp4',
                'title': str,
                'description': str,
                'upload_date': str,
                'is_live': True,
                'live_status': 'is_live',

Review comment (refactor):
```suggestion

        return {
            'id': video_id,
            'formats': self._extract_m3u8_formats(
                urljoin('https://watch.parti.com', data['livestream_recording']), video_id, 'mp4'),
```

Code after:
        'info_dict': {
            'id': '66284',
            'ext': 'mp4',
            'title': 'NOW LIVE ',
            'upload_date': '20250327',
            'categories': ['Gaming'],
            'thumbnail': 'https://assets.parti.com/351424_eb9e5250-2821-484a-9c5f-ca99aa666c87.png',
            'channel': 'ItZTMGG',
            'timestamp': 1743044379,
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        data = self._call_api(f'get_livestream_channel_info/recent/{video_id}', video_id)

        return {
            'id': video_id,
            'formats': self._extract_m3u8_formats(
                urljoin('https://watch.parti.com', data['livestream_recording']), video_id, 'mp4'),
            **traverse_obj(data, {
                'title': ('event_title', {str}),
                'channel': ('user_name', {str}),
                'thumbnail': ('event_file', {url_or_none}),
                'categories': ('category_name', {str}, filter, all),
                'timestamp': ('event_start_ts', {int_or_none}),
            }),
        }


class PartiLivestreamIE(PartiBaseIE):
    IE_NAME = 'parti:livestream'
    _VALID_URL = r'https?://(?:www\.)?parti\.com/creator/(?P<service>[\w]+)/(?P<id>[\w/-]+)'
    _TESTS = [{
        'url': 'https://parti.com/creator/parti/Capt_Robs_Adventures',
        'info_dict': {
            'id': 'Capt_Robs_Adventures',
            'ext': 'mp4',
            'title': r"re:I'm Live on Parti \d{4}-\d{2}-\d{2} \d{2}:\d{2}",
            'view_count': int,
            'thumbnail': r're:https://assets\.parti\.com/.+\.png',
            'timestamp': 1743879776,
            'upload_date': '20250405',
            'live_status': 'is_live',
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://parti.com/creator/discord/sazboxgaming/0',
        'only_matching': True,
    }]