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

Code before:
        'url': 'https://www.globalplayer.com/catchup/lbc/uk/episodes/2zGq26Vcv1fCWhddC4JAwETXWe/',
        'info_dict': {
            'id': '2zGq26Vcv1fCWhddC4JAwETXWe',
            'ext': 'm4a',
            'title': 'Nick Ferrari',
            'duration': 10800,
            'description': 'md5:53b6fa5ef71a3cff6628551bcc416384',
            'thumbnail': 'md5:4df24d8a226f5b2508efbcc6ae874ebf',
            'series_id': '46vyD7z',
            'upload_date': '20230421',
            'timestamp': 1682056800,
            'series': 'Nick Ferrari',
        },
    }]

    def _real_extract(self, url):
        video_id, podcast = self._match_valid_url(url).group('id', 'podcast')
        props = self._get_pageProps(url, video_id)
        if podcast:
            episode = props['podcastEpisode']
            series = episode['podcast']
        else:
            episode = props['catchupEpisode']
            series = episode['show']

        return self._extract_audio(episode, series)


class GlobalPlayerVideoIE(GlobalPlayerBaseIE):
    _VALID_URL = r'https?://www\.globalplayer\.com/videos/(?P<id>\w+)/$'
    _TESTS = [{
        'url': 'https://www.globalplayer.com/videos/2JsSZ7Gm2uP/',
        'info_dict': {
            'id': '2JsSZ7Gm2uP',
            'thumbnail': 'md5:d4498af48e15aae4839ce77b97d39550',
            'title': 'Treble Malakai Bayoh sings a sublime Handel aria at Classic FM Live',
            'upload_date': '20230420',
            'ext': 'mp4',
            'description': 'md5:6a9f063c67c42f218e42eee7d0298bfd',
        }
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        meta = self._get_pageProps(url, video_id)['videoData']

        return traverse_obj(meta, {
            'id': 'id',
            'thumbnail': ('image', 'url'),
            'title': 'title',
            'upload_date': ('publish_date', {unified_strdate}),

Review comment (refactor):
`series` is only used for metadata, shouldn't be fatal
```suggestion
        episode = props['podcastEpisode'] if podcast else props['catchupEpisode']

        return self._extract_audio(
            episode, traverse_obj(episode, 'podcast', 'show', expected_type=dict) or {})
```

Code after:
    def _real_extract(self, url):
        video_id, podcast = self._match_valid_url(url).group('id', 'podcast')
        props = self._get_page_props(url, video_id)
        episode = props['podcastEpisode'] if podcast else props['catchupEpisode']

        return self._extract_audio(
            episode, traverse_obj(episode, 'podcast', 'show', expected_type=dict) or {})


class GlobalPlayerVideoIE(GlobalPlayerBaseIE):
    _VALID_URL = r'https?://www\.globalplayer\.com/videos/(?P<id>\w+)'
    _TESTS = [{
        'url': 'https://www.globalplayer.com/videos/2JsSZ7Gm2uP/',
        'info_dict': {
            'id': '2JsSZ7Gm2uP',
            'ext': 'mp4',
            'description': 'md5:6a9f063c67c42f218e42eee7d0298bfd',
            'thumbnail': 'md5:d4498af48e15aae4839ce77b97d39550',
            'upload_date': '20230420',
            'title': 'Treble Malakai Bayoh sings a sublime Handel aria at Classic FM Live',
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        meta = self._get_page_props(url, video_id)['videoData']

        return {
            'id': video_id,
            **traverse_obj(meta, {
                'url': 'url',
                'thumbnail': ('image', 'url'),
                'title': 'title',
                'upload_date': ('publish_date', {unified_strdate}),
                'description': 'description',
            }),
        }