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

Code before:
                'locale': 'en-us',
                '$skip': skip,
            })
            items = traverse_obj(playlist_info, (
                'results', ..., 'url', {lambda x: self.url_result(f'https://learn.microsoft.com/en-us{x}')}))
            yield from items
            skip += len(items)
            if skip >= playlist_info['count'] or not items:
                break

    def _real_extract(self, url):
        playlist_id, playlist_type = self._match_valid_url(url).group('id', 'type')
        webpage = self._download_webpage(url, playlist_id)

        metainfo = {
            'title': self._og_search_title(webpage),
            'description': self._og_search_description(webpage),
        }
        sub_type = 'episodes' if playlist_type == 'shows' else 'sessions'

        url_base = f'https://learn.microsoft.com/api/contentbrowser/search/{playlist_type}/{playlist_id}/{sub_type}'
        return self.playlist_result(self._entries(url_base, playlist_id), playlist_id, **metainfo)


class MicrosoftLearnEpisodeIE(MicrosoftMediusBaseIE):
    _VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w\-]+/)?shows/[\w\-]+/(?P<id>[^?#/]+)'
    _TESTS = [{
        'url': 'https://learn.microsoft.com/en-us/shows/bash-for-beginners/what-is-the-difference-between-a-terminal-and-a-shell-2-of-20-bash-for-beginners/',
        'info_dict': {
            'id': 'd44e1a03-a0e5-45c2-9496-5c9fa08dc94c',
            'ext': 'ismv',
            'title': 'What is the Difference Between a Terminal and a Shell? (Part 2 of 20)',
            'description': 'md5:7bbbfb593d21c2cf2babc3715ade6b88',
            'timestamp': 1676339547,
            'upload_date': '20230214',
            'thumbnail': r're:https://learn\.microsoft\.com/video/media/.*\.png',
            'subtitles': 'count:14',
        },
    }]

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

        entry_id = self._html_search_meta('entryId', webpage, 'entryId', fatal=True)
        video_info = self._download_json(
            f'https://learn.microsoft.com/api/video/public/v1/entries/{entry_id}', video_id)
        return {
            'id': entry_id,
            'formats': self._extract_ism(video_info['publicVideo']['adaptiveVideoUrl'], video_id),
            'subtitles': self._sub_to_dict(traverse_obj(video_info, ('publicVideo', 'captions', ..., {

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w-]+/)?shows/[\w-]+/(?P<id>[^?#/]+)'
```

Code after:
            url_paths = traverse_obj(playlist_info, ('results', ..., 'url', {str}))
            for url_path in url_paths:
                yield self.url_result(f'https://learn.microsoft.com/en-us{url_path}')
            skip += len(url_paths)
            if skip >= playlist_info.get('count', 0) or not url_paths:
                break

    def _real_extract(self, url):
        playlist_id, playlist_type = self._match_valid_url(url).group('id', 'type')
        webpage = self._download_webpage(url, playlist_id)

        metainfo = {
            'title': self._og_search_title(webpage),
            'description': self._og_search_description(webpage),
        }
        sub_type = 'episodes' if playlist_type == 'shows' else 'sessions'

        url_base = f'https://learn.microsoft.com/api/contentbrowser/search/{playlist_type}/{playlist_id}/{sub_type}'
        return self.playlist_result(self._entries(url_base, playlist_id), playlist_id, **metainfo)


class MicrosoftLearnEpisodeIE(MicrosoftMediusBaseIE):
    _VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w-]+/)?shows/[\w-]+/(?P<id>[^?#/]+)'
    _TESTS = [{
        'url': 'https://learn.microsoft.com/en-us/shows/bash-for-beginners/what-is-the-difference-between-a-terminal-and-a-shell-2-of-20-bash-for-beginners/',
        'info_dict': {
            'id': 'd44e1a03-a0e5-45c2-9496-5c9fa08dc94c',
            'ext': 'ismv',
            'title': 'What is the Difference Between a Terminal and a Shell? (Part 2 of 20)',
            'description': 'md5:7bbbfb593d21c2cf2babc3715ade6b88',
            'timestamp': 1676339547,
            'upload_date': '20230214',
            'thumbnail': r're:https://learn\.microsoft\.com/video/media/.*\.png',
            'subtitles': 'count:14',
        },
    }]

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

        entry_id = self._html_search_meta('entryId', webpage, 'entryId', fatal=True)
        video_info = self._download_json(
            f'https://learn.microsoft.com/api/video/public/v1/entries/{entry_id}', video_id)
        return {
            'id': entry_id,
            'formats': self._extract_ism(video_info['publicVideo']['adaptiveVideoUrl'], video_id),
            'subtitles': self._sub_to_dict(traverse_obj(video_info, (
                'publicVideo', 'captions', lambda _, v: url_or_none(v['url']), {
                    'tag': ('language', {str}),
                    'url': 'url',